Author: martin
Date: 2005-09-07 12:21:57 -0400 (Wed, 07 Sep 2005)
New Revision: 49643
Modified:
trunk/debugger/ChangeLog
trunk/debugger/backends/SingleSteppingEngine.cs
trunk/debugger/backends/server/i386-arch.c
trunk/debugger/backends/server/x86_64-arch.c
trunk/debugger/test/mono-debugger.tests/TestException.exp
Log:
2005-09-07 Martin Baulig <[EMAIL PROTECTED]>
* backends/SingleSteppingEngine.cs
(SingleSteppingEngine.throw_exception): Always ignore the
exception if we're in an OperationRuntimeInvoke.
* backends/server/x86_64-arch.cs (x86_arch_child_stopped): On
runtime invoke, we must read the exception object from the
exception address.
* tests/mono-debugger.tests/TestException.exp: Added testcase.
Modified: trunk/debugger/ChangeLog
===================================================================
--- trunk/debugger/ChangeLog 2005-09-07 16:06:03 UTC (rev 49642)
+++ trunk/debugger/ChangeLog 2005-09-07 16:21:57 UTC (rev 49643)
@@ -1,6 +1,18 @@
2005-09-07 Martin Baulig <[EMAIL PROTECTED]>
* backends/SingleSteppingEngine.cs
+ (SingleSteppingEngine.throw_exception): Always ignore the
+ exception if we're in an OperationRuntimeInvoke.
+
+ * backends/server/x86_64-arch.cs (x86_arch_child_stopped): On
+ runtime invoke, we must read the exception object from the
+ exception address.
+
+ * tests/mono-debugger.tests/TestException.exp: Added testcase.
+
+2005-09-07 Martin Baulig <[EMAIL PROTECTED]>
+
+ * backends/SingleSteppingEngine.cs
(SingleSteppingEngine.ProcessChildEvent): Handle exceptions first.
2005-09-07 Martin Baulig <[EMAIL PROTECTED]>
Modified: trunk/debugger/backends/SingleSteppingEngine.cs
===================================================================
--- trunk/debugger/backends/SingleSteppingEngine.cs 2005-09-07 16:06:03 UTC
(rev 49642)
+++ trunk/debugger/backends/SingleSteppingEngine.cs 2005-09-07 16:21:57 UTC
(rev 49643)
@@ -792,6 +792,9 @@
current_operation.StartFrame == ip)
return false;
+ if (current_operation is OperationRuntimeInvoke)
+ return false;
+
foreach (Breakpoint bpt in exception_handlers.Values) {
Report.Debug (DebugFlags.SSE,
"{0} invoking exception handler
{1} for {0}",
Modified: trunk/debugger/backends/server/i386-arch.c
===================================================================
--- trunk/debugger/backends/server/i386-arch.c 2005-09-07 16:06:03 UTC (rev
49642)
+++ trunk/debugger/backends/server/i386-arch.c 2005-09-07 16:21:57 UTC (rev
49643)
@@ -31,6 +31,7 @@
INFERIOR_REGS_TYPE *saved_regs;
INFERIOR_FPREGS_TYPE *saved_fpregs;
long call_address;
+ long exc_address;
guint64 callback_argument;
} RuntimeInvokeData;
@@ -258,6 +259,7 @@
rdata->saved_regs = g_memdup (&arch->current_regs, sizeof
(arch->current_regs));
rdata->saved_fpregs = g_memdup (&arch->current_fpregs, sizeof
(arch->current_fpregs));
rdata->call_address = new_esp + static_size;
+ rdata->exc_address = 14 + (num_params + 1) * 4;
rdata->callback_argument = callback_argument;
call_disp = (int) invoke_method - new_esp;
@@ -396,8 +398,10 @@
*callback_arg = rdata->callback_argument;
*retval = (guint32) INFERIOR_REG_EAX (arch->current_regs);
- *retval2 = (guint32) INFERIOR_REG_EDX (arch->current_regs);
+ if (server_ptrace_peek_word (handle, rdata->exc_address,
retval2) != COMMAND_ERROR_NONE)
+ g_error (G_STRLOC ": Can't get exc object");
+
g_free (rdata->saved_regs);
g_free (rdata->saved_fpregs);
g_ptr_array_remove (arch->rti_stack, rdata);
Modified: trunk/debugger/backends/server/x86_64-arch.c
===================================================================
--- trunk/debugger/backends/server/x86_64-arch.c 2005-09-07 16:06:03 UTC
(rev 49642)
+++ trunk/debugger/backends/server/x86_64-arch.c 2005-09-07 16:21:57 UTC
(rev 49643)
@@ -29,6 +29,7 @@
INFERIOR_REGS_TYPE *saved_regs;
INFERIOR_FPREGS_TYPE *saved_fpregs;
long call_address;
+ long exc_address;
guint64 callback_argument;
} RuntimeInvokeData;
@@ -196,8 +197,10 @@
*callback_arg = rdata->callback_argument;
*retval = INFERIOR_REG_RAX (arch->current_regs);
- *retval2 = 0;
+ if (server_ptrace_peek_word (handle, rdata->exc_address,
retval2) != COMMAND_ERROR_NONE)
+ g_error (G_STRLOC ": Can't get exc object");
+
g_free (rdata->saved_regs);
g_free (rdata->saved_fpregs);
g_ptr_array_remove (arch->rti_stack, rdata);
@@ -649,13 +652,14 @@
ptr [i] = param_data [i];
}
- *((guint64 *) code) = new_rsp + 24;
+ *((guint64 *) code) = new_rsp + static_size;
*((guint64 *) (code+8)) = callback_argument;
rdata = g_new0 (RuntimeInvokeData, 1);
rdata->saved_regs = g_memdup (&arch->current_regs, sizeof
(arch->current_regs));
rdata->saved_fpregs = g_memdup (&arch->current_fpregs, sizeof
(arch->current_fpregs));
- rdata->call_address = new_rsp + 24;
+ rdata->call_address = new_rsp + static_size;
+ rdata->exc_address = new_rsp + 16;
rdata->callback_argument = callback_argument;
server_ptrace_write_memory (handle, (unsigned long) new_rsp, size,
code);
Modified: trunk/debugger/test/mono-debugger.tests/TestException.exp
===================================================================
--- trunk/debugger/test/mono-debugger.tests/TestException.exp 2005-09-07
16:06:03 UTC (rev 49642)
+++ trunk/debugger/test/mono-debugger.tests/TestException.exp 2005-09-07
16:21:57 UTC (rev 49643)
@@ -15,6 +15,8 @@
mdb_send "continue"
mdb_expect_line "EXCEPTION: System.InvalidOperationException"
mdb_expect_stopped 0 "X.Main()" $file 19
+mdb_send "print x.Test()"
+mdb_expect_line "ERROR: Invocation of `x.Test ()' raised an exception:
System.InvalidOperationException: Operation is not valid due to the current
state of the object"
mdb_send "continue"
mdb_expect_line "Done"
mdb_expect_line "Process @4 terminated normally."
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches