Bug 2092 - Cannot set a breakpoint at continue
Summary: Cannot set a breakpoint at continue
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2011-11-18 15:10 UTC by Marek Safar
Modified: 2011-12-08 23:23 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Marek Safar 2011-11-18 15:10:32 UTC
using System;

namespace test66
	class MainClass
		public static void Main (string[] args)
			for (int i = 0; i < 10; ++i)
				continue;  // Set a breakpoint here but MD is confused and uses different location
Comment 1 Jeffrey Stedfast 2011-12-08 17:46:17 UTC
To expand on Marek's bug report, what happens is that when the debugger hits this breakpoint, the "for (...)" line is highlighted instead of the "continue" line.

Other than using a different namespace, I used the above code exactly.

Here's what I get in my annotated log:

Resolving breakpoints in type BreakOnContinue.MainClass
	iterating over breakpoints in: /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs
		pending breakpoint: /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:12
		iterating over methods...
			method = Void BreakOnContinue.MainClass:.ctor ()
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:5 ILOffset = 6
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:5 ILOffset = 6
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:5 ILOffset = 6
		range = 5 to 5
			method = Void BreakOnContinue.MainClass:Main (String[])
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:8 ILOffset = 0
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:9 ILOffset = 0
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:9 ILOffset = 0
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:9 ILOffset = 0
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:10 ILOffset = 7
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:11 ILOffset = 7
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:12 ILOffset = 14
				setting target_loc to /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:12 ILOffset=14
			location = /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:9 ILOffset = 19
		location = method=Void BreakOnContinue.MainClass:Main (String[]), line=12, ILOffset=14; insideLoadedRange = False

we then pass that ILOffset to the vm to set the breakpoint.

According to the Application Output window:

Resolved pending breakpoint at '/Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:12' to Void BreakOnContinue.MainClass:Main (String[]) [0x0000e].

0x0e suggests the BP was inserted at ILOffset 14

Here's what we're getting from the VM:

breakpoint hit: /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:12
CreateStackFrame(): BreakOnContinue.MainClass.Main @ /Users/fejj/Projects/BreakOnContinue/BreakOnContinue/Main.cs:9 ILOffset=19

So MonoDevelop is inserting a breakpoint at ILOffset 14, it's getting hit by the VM, but the StackFrame we get from the VM is telling us ILOffset 19 at line 9, so that's where we place the "CurrentExecutionLine" marker.
Comment 2 Jeffrey Stedfast 2011-12-08 17:48:44 UTC
Reassigning to Zoltan so he can take a look and decide if it's a VM or MCS bug.
Comment 3 Zoltan Varga 2011-12-08 23:23:15 UTC
Fixed in HEAD. Won't backport it for now, since the fix feels kinda risky.