[sdb] Fix state initialization of suspended threads to work when the debugger thread...
authorRodrigo Kumpera <kumpera@gmail.com>
Tue, 13 Oct 2015 22:33:00 +0000 (18:33 -0400)
committerRodrigo Kumpera <kumpera@gmail.com>
Thu, 15 Oct 2015 20:42:53 +0000 (16:42 -0400)
commit86a15b2059a510b5b24dff78dc27a73dd8cd8794
treedd4b68d691b2f6afb09ea7a5cda87aa0fb229d4b
parent714ace0119adeaba1b5f68cdcb15ddae7d2711f0
[sdb] Fix state initialization of suspended threads to work when the debugger thread is not attached. Fixes #34750

The problem happens because thread_interrupt runs in the debugger thread (suspend initiator).

thread_interrupt then calls mono_thread_state_init_from_monoctx which collects the state of the current thread
which is definitely not what we wanted.

There used to be some compensation code after calling mono_thread_state_init_from_monoctx to actually init the state properly.
This is why it worked, at all.

Thew problem is that the debugger thread now might not attach at all under some circumstances, which would trigger
mono_thread_state_init_from_monoctx to return FALSE and trip into the assert.

The fix is to simply not use mono_thread_state_init_from_monoctx at all, just copy the state from data. This fix has the
bonus of getting the domain correctly.
mono/mini/debugger-agent.c