Bug 17310 - stepping through code breaks execution
Summary: stepping through code breaks execution
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2014-01-18 12:12 UTC by Sander
Modified: 2014-01-21 18:58 UTC (History)
4 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 Sander 2014-01-18 12:12:07 UTC
In the following code: 

static double f(double a)
	return a * 2;
public static void Main (string[] args)
	double d = 2;
	double d2 = f (d);
	Console.WriteLine ("f(" + d + ") = " + d2);
	Console.ReadLine ();

the output is incorrect when stepping through code. If I place a breakpoint in the first line of Main, and then Step Over until I reach the readline, the output is incorrect in both the console and the locals view (it reads 3.75). If I place a breakpoint on each line, and repeat Run to the readline (rather than stepping), the output is correct. 

If I step into the f() function, I see the parameter A equals 4.5 in the locals view, and the function returns 1.5.
Comment 1 Zoltan Varga 2014-01-18 22:12:17 UTC
What platform/mono version is this ?
Comment 2 Sander 2014-01-19 04:46:27 UTC
I use MonoDevelop 4.1.7 on Ubuntu Linux.
mono --version yields:
Mono Runtime Engine version 3.2.3 (master/9acd6e3 vr okt 18 22:00:18 CEST 2013)
Copyright (C) 2002-2013 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 3 Zoltan Varga 2014-01-21 14:51:03 UTC
I can reproduce this. Seems like its amd64 only, the x86 version works fine.
Comment 4 Zoltan Varga 2014-01-21 18:58:57 UTC
Fixed in master 216ccda87a16eb92fd89ef54e0d9e8af5fa8f6b3.