2009-12-13 Jonathan Chambers <joncham@gmail.com>
authorJonathan Chambers <joncham@gmail.com>
Sun, 13 Dec 2009 18:07:01 +0000 (18:07 -0000)
committerJonathan Chambers <joncham@gmail.com>
Sun, 13 Dec 2009 18:07:01 +0000 (18:07 -0000)
* debugger-agent.c (mono_debugger_agent_thread_interrupt): Handle a NULL
sigctx being passed in, as we have no CONTEXT available in the APC.

(mono_debugger_agent_cleanup): Use explicit cond wait implementation
for now.

Code contributed under MIT/X11 license.

svn path=/trunk/mono/; revision=148351

mono/mini/ChangeLog
mono/mini/debugger-agent.c

index 4bb4dfcf88b4cdca7310121da56186a9555e592f..a9ac9f43a5fa1e4e85e18939d583cedbf157c78e 100644 (file)
@@ -1,3 +1,13 @@
+2009-12-13 Jonathan Chambers <joncham@gmail.com>
+
+       * debugger-agent.c (mono_debugger_agent_thread_interrupt): Handle a NULL
+       sigctx being passed in, as we have no CONTEXT available in the APC.
+       
+       (mono_debugger_agent_cleanup): Use explicit cond wait implementation
+       for now.
+
+       Code contributed under MIT/X11 license.
+
 2009-12-13  Zoltan Varga  <vargaz@gmail.com>
 
        * method-to-ir.c mini-llvm.c: Fix support for monitor enter/exit trampolines
index 375ff4098fbabb511766918d83cdb0bf47581997..fcd58c03983add6663bcbbf154caa4358f21d9ed 100644 (file)
@@ -834,8 +834,17 @@ mono_debugger_agent_cleanup (void)
        //WaitForSingleObject (debugger_thread_handle, INFINITE);
        if (GetCurrentThreadId () != debugger_thread_id) {
                mono_mutex_lock (&debugger_thread_exited_mutex);
-               if (!debugger_thread_exited)
+               if (!debugger_thread_exited) {
+#ifdef HOST_WIN32
+                       if (WAIT_TIMEOUT == WaitForSingleObject(debugger_thread_exited_cond, 0)) {
+                               mono_mutex_unlock (&debugger_thread_exited_mutex);
+                               Sleep(0);
+                               mono_mutex_lock (&debugger_thread_exited_mutex);
+                       }
+#else
                        mono_cond_wait (&debugger_thread_exited_cond, &debugger_thread_exited_mutex);
+#endif
+               }
                mono_mutex_unlock (&debugger_thread_exited_mutex);
        }
 
@@ -1787,7 +1796,6 @@ mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji)
                        MonoContext ctx;
                        GetLastFrameUserData data;
 
-                       mono_arch_sigctx_to_monoctx (sigctx, &ctx);
                        // FIXME: printf is not signal safe, but this is only used during
                        // debugger debugging
                        DEBUG (1, printf ("[%p] Received interrupt while at %p, treating as suspended.\n", (gpointer)GetCurrentThreadId (), mono_arch_ip_from_context (sigctx)));
@@ -1808,7 +1816,10 @@ mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji)
                         * remain valid.
                         */
                        data.last_frame_set = FALSE;
-                       mono_jit_walk_stack_from_ctx_in_thread (get_last_frame, mono_domain_get (), &ctx, FALSE, tls->thread, mono_get_lmf (), &data);
+                       if (sigctx) {
+                               mono_arch_sigctx_to_monoctx (sigctx, &ctx);
+                               mono_jit_walk_stack_from_ctx_in_thread (get_last_frame, mono_domain_get (), &ctx, FALSE, tls->thread, mono_get_lmf (), &data);
+                       }
                        if (data.last_frame_set) {
                                memcpy (&tls->async_last_frame, &data.last_frame, sizeof (StackFrameInfo));
                                memcpy (&tls->async_ctx, &data.ctx, sizeof (MonoContext));