[Mono-list] Why doesn't Mono include full stack trace information into exception?
Andrei Faber
andrei.faber at gmail.com
Tue Dec 31 03:37:09 UTC 2013
Thanks.
On 30/12/2013 23:38, Jonathan Pryor wrote:
> On Dec 30, 2013, at 9:25 AM, Andrei Faber <andrei.faber at gmail.com> wrote:
>> Why debugging symbols are required to show full stack trace? MS .NET doesn't require that.
> Good question -- it doesn't make sense, as the methods are still present in the IL.
>
> Using `mcs -debug+` doesn't help either, so that's not actually an answer:
>
> $ mcs -debug+ st.cs
> $ mono --debug st.exe
> System.ApplicationException: An application exception has occurred.
> at Program.Main (System.String[] args) [0x00001] in /Users/jon/tmp/csharp/st.cs:8
>
> So what's going on? Inlining: Foo() and Bar() are so small that the JIT is inlining them, so Main() _is_ throwing ApplicationException.
>
> Which doesn't entirely help you when you experience this...
>
> The workaround? Specify --debug=mdb-optimizations (see `mono --help-debug`), which:
>
>> Disable some JIT optimizations which are normally
>> disabled when running inside the debugger.
>> This is useful if you plan to attach to the running
>> process with the debugger.
>
> Thus:
>
> $ mono --debug=mdb-optimizations st.exe
> System.ApplicationException: An application exception has occurred.
> at Program.Bar () [0x00001] in /Users/jon/tmp/csharp/st.cs:24
> at Program.Foo () [0x00001] in /Users/jon/tmp/csharp/st.cs:19
> at Program.Main (System.String[] args) [0x00002] in /Users/jon/tmp/csharp/st.cs:9
>
> Alternatively, you could disable inlining (`mono --list-opt`):
>
> $ mono --debug --optimize=-inline st.exe
> System.ApplicationException: An application exception has occurred.
> at Program.Bar () [0x00001] in /Users/jon/tmp/csharp/st.cs:24
> at Program.Foo () [0x00001] in /Users/jon/tmp/csharp/st.cs:19
> at Program.Main (System.String[] args) [0x00002] in /Users/jon/tmp/csharp/st.cs:9
>
> - Jon
>
>
--
Best wishes,
Andrei Faber
More information about the Mono-list
mailing list