Bug 29045 - Incorrect stacktrace for exceptions
Summary: Incorrect stacktrace for exceptions
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Mac OS
: --- major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-13 11:27 UTC by Marek Safar
Modified: 2015-04-17 14:40 UTC (History)
3 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 NOT_ON_ROADMAP

Description Marek Safar 2015-04-13 11:27:46 UTC
using System;

public class Tests
{
	static void ThrowException ()
	{
		throw new Exception ("test");
	}

	public static void Main (String[] args)
	{
		Exception e = null;
		try {
			ThrowException ();
		} catch (NotImplementedException e2) {
		}
	}
}

mcs test.cs -debug
mono --debug test-3.exe

Unhandled Exception:
System.Exception: test
  at Tests.Main (System.String[] args) [0x00003] in test.cs:13


The stack trace is wrong it should include ThrowException and not include line 13 at all
Comment 1 Zoltan Varga 2015-04-13 15:21:25 UTC
This happens because of inlining. With -O=-inline, it works as expected.
Comment 2 Zoltan Varga 2015-04-17 13:43:47 UTC
-> NOTABUG.
Comment 3 Marek Safar 2015-04-17 13:59:04 UTC
Cannot -debug do -inline? This is quite surprising to see during debugging
Comment 4 Zoltan Varga 2015-04-17 14:40:50 UTC
-debug currently only enables the generation of debug info, it doesn't change the generated code.