[Mono-bugs] [Bug 376841] New: Exception handling inside the debugger

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 3 12:19:34 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=376841


           Summary: Exception handling inside the debugger
           Product: Mono: Runtime
           Version: unspecified
          Platform: x86-64
        OS/Version: openSUSE 10.3
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: vargaz at gmail.com
        ReportedBy: martin at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


There is some little problem in throw_exception() when exceptions are caught by
the debugger.

If you have a simple `throw new InvalidOperationException ()', the JIT
generates code like this:

X.Test():
0x400104e0      push   %rbp
0x400104e1      mov    %rsp,%rbp
0x400104e4      sub    $0x10,%rsp
0x400104e8      mov    $0x2000138,%edi
0x400104ed      callq  0x523490:mini_method_compile+0x29e0
0x400104f2      mov    %rax,0xfffffffffffffff8(%rbp)
0x400104f6      mov    %rax,%rdi
0x400104f9      callq  0x400021a0
0x400104fe      leaveq 
0x400104ff      retq   

If you have an exception catchpoint for that exception in the debugger, we land
inside the mono_debugger_throw_exception() if-block in exceptions-amd64.c,
lines 295-316.

This code should set ctx.rip and ctx.rsp to the instruction just in front of
the call to `throw_exception' and call restore_context().

The debugger will stop at that instruction and let the user look at the
exception.

The problem is that this code currently sets us back at 0x400104f6, but it
doesn't correctly restore %rax - it also doesn't restore %rdi, so setting it at
0x400104f9 also won't work.

So if you type `continue' in the debugger, the target will crash.

Since we have the original %rax inside throw_exception() in the `exc'
parameter, would it be possible to use a custom restore context just in this
special scenario when we're about to give control back to the debugger anyways
?

Martin


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list