Bug 4517 - Step out goes too far
Summary: Step out goes too far
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: High normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-04-19 06:41 UTC by Jb Evain
Modified: 2015-02-20 12:29 UTC (History)
4 users (show)

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

repro (2.57 KB, application/zip)
2012-04-19 06:41 UTC, Jb Evain
Repro with the augmented mdb (148.08 KB, application/zip)
2012-04-19 09:19 UTC, Jb Evain

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 Jb Evain 2012-04-19 06:41:04 UTC
Created attachment 1700 [details]

To repro:

Unzip, make && make start

This will start the debuggee.

mono debugger.exe to start the debugger.

Press enter in the debuggee to continue the test
Observe the debugger. It outputs:

hit breakpoint at line: 10:		var a = Add (Forty (), Two ());
stepped, now on line: 20:	{
stepped, now on line: 21:		return 40;
stepped, now on line: 11:		Console.WriteLine (a);

The debugger correctly steps into the body of Forty.
We step out of Forty.

After we've stepped out of of Forty, the debugger is on line 11, preventing us
to step into Two().

I expect to be back on line 10, and to be able to step into Two.

Of course it's very similar to bug #4516, but I figured I'd file separate bugs for the separate kind of stepping.
Comment 1 Jb Evain 2012-04-19 09:01:34 UTC
Maybe this is a compiler bug.

The Main method of the debuggee is as follow:

        // Method begins at RVA 0x2050
	// Code size 34 (0x22)
	.maxstack 2
	.locals init (
		int32	V_0)
	IL_0000:  nop 
	IL_0001:  ldstr "run the test"
	IL_0006:  call void class Program::Enter(string)
	IL_000b:  call int32 class Program::Forty()
	IL_0010:  call int32 class Program::Two()
	IL_0015:  call int32 class Program::Add(int32, int32)
	IL_001a:  stloc.0 
	IL_001b:  ldloc.0 
	IL_001c:  call void class [mscorlib]System.Console::WriteLine(int32)
	IL_0021:  ret 
    } // end of method Program::Main

And it has the following symbols:

Location offset: 0x0000, line number: 7
Location offset: 0x0001, line number: 8
Location offset: 0x000b, line number: 10
Location offset: 0x001b, line number: 11
Location offset: 0x0021, line number: 12
Location offset: 0x0021, line number: 12

There's no intermediate location at IL_0010 and IL_0015 at line 11.

I'll try to see if sdb works fine if we add those symbols to the mdb file.
Comment 2 Jb Evain 2012-04-19 09:17:59 UTC
Even after adding a IL sequence in the mdb at IL_0010 and another one at IL_0015 for line 10, sdb on stepping out jump right to line 11.
Comment 3 Jb Evain 2012-04-19 09:19:08 UTC
Created attachment 1702 [details]
Repro with the augmented mdb
Comment 4 Jb Evain 2012-04-19 09:19:47 UTC
s/IL sequence/IL sequence point
Comment 5 Jeffrey Stedfast 2012-04-19 11:09:50 UTC
this seems possibly related to bug #4433
Comment 6 Jb Evain 2012-05-04 03:36:21 UTC
Zoltan fixed it in: