Bug 4549 - Cannot step-into static call
Summary: Cannot step-into static call
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Linux
: Normal major
Target Milestone: ---
Assignee: Zoltan Varga
URL:
: 4519 ()
Depends on:
Blocks:
 
Reported: 2012-04-20 05:01 UTC by Marek Safar
Modified: 2012-04-27 16:15 UTC (History)
4 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Marek Safar 2012-04-20 05:01:57 UTC
using System;
using System.Threading.Tasks;
using System.Threading;

class C
{
    public static void Main()
    {
		while (true)
		{
			var cancelation = new CancellationTokenSource ();
	
			var t = Task.Delay (5000, cancelation.Token); // Set a breakpoint here and Step-Into (F11)
			if (t.Status != TaskStatus.WaitingForActivation)
				throw new ApplicationException (t.Status.ToString ());
			
			cancelation.Cancel ();
		}
		
		
		return;
    }
}

With Framework Debugging enabled MD ends up inside Cancel when stepping into Delay
Comment 1 Zoltan Varga 2012-04-25 05:14:06 UTC
I think this is the same 'step over property accessors'  problem.
Comment 2 Marek Safar 2012-04-25 05:52:04 UTC
Can we finally fix this issue ? I looked at what csc is doing and all what I could found out is that it inserts nop after each invocation statement (not invocation!). I tried to modify mcs to emit exactly same code as csc does which works with .NET debugger but this does not work with mono either.

Here is test I have been using

using System;

class C
{
	public int Foo {
		get {
			return 1;
		}
	}
	
	public static void Test (int arg, int b)
	{
		return;
	}
	
	public static void Main ()
	{
		var c = new C ();
		Test (c.Foo, 1);
	}
}
Comment 3 Marek Safar 2012-04-25 05:54:48 UTC
Enhanced IL which works with .net but does not with Mono

	IL_0000:  nop 
	IL_0001:  newobj instance void class C::'.ctor'()
	IL_0006:  stloc.0 
	IL_0007:  ldloc.0 
	IL_0008:  callvirt instance int32 class C::get_Foo()
	IL_000d:  ldc.i4.1 
	IL_000e:  call void class C::Test(int32, int32)
	IL_0013:  nop <--- Extra nop but that makes no difference to mono
	IL_0014:  ret
Comment 4 Marek Safar 2012-04-25 05:56:18 UTC
*** Bug 4519 has been marked as a duplicate of this bug. ***
Comment 5 Zoltan Varga 2012-04-25 06:18:45 UTC
Try turning off the 'step over properties and operators' md option.
Comment 6 Zoltan Varga 2012-04-25 06:21:36 UTC
Try turning off the 'step over properties and operators' md option as a workaround.

It looks like the step out code in the sdb is broken in master.
Comment 7 Zoltan Varga 2012-04-25 06:34:29 UTC
Should be fixed in master.
Comment 8 Miguel de Icaza [MSFT] 2012-04-27 15:23:05 UTC
Any chance this could end up eventually in mobile-master?
Comment 9 Zoltan Varga 2012-04-27 16:15:07 UTC
The current fix is not perfect, we insert too many seq points, so some things actually become worse.