}
gboolean
-mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle)
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
{
kern_return_t ret;
mach_msg_type_number_t num_state;
mcontext_t mctx;
MonoJitTlsData *jit_tls;
void *domain;
- MonoLMF *lmf;
- MonoThreadInfo *info;
+ MonoLMF *lmf = NULL;
+ gpointer *addr;
+ g_assert (info);
/*Zero enough state to make sure the caller doesn't confuse itself*/
tctx->valid = FALSE;
tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = NULL;
state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
- ret = mono_mach_arch_get_thread_state (thread_handle, state, &num_state);
+ ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
if (ret != KERN_SUCCESS)
return FALSE;
mono_sigctx_to_monoctx (&ctx, &tctx->ctx);
- info = mono_thread_info_lookup (thread_id);
-
- if (info) {
- /* mono_set_jit_tls () sets this */
- jit_tls = mono_thread_info_tls_get (info, TLS_KEY_JIT_TLS);
- /* SET_APPDOMAIN () sets this */
- domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
- } else {
- jit_tls = NULL;
- domain = NULL;
- }
+ /* mono_set_jit_tls () sets this */
+ jit_tls = mono_thread_info_tls_get (info, TLS_KEY_JIT_TLS);
+ /* SET_APPDOMAIN () sets this */
+ domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
/*Thread already started to cleanup, can no longer capture unwind state*/
if (!jit_tls || !domain)
* arch-specific code. But the address of the TLS variable is stored in another TLS variable which
* can be accessed through MonoThreadInfo.
*/
- lmf = NULL;
- if (info) {
- gpointer *addr;
-
- /* mono_set_lmf_addr () sets this */
- addr = mono_thread_info_tls_get (info, TLS_KEY_LMF_ADDR);
- if (addr)
- lmf = *addr;
- }
+ /* mono_set_lmf_addr () sets this */
+ addr = mono_thread_info_tls_get (info, TLS_KEY_LMF_ADDR);
+ if (addr)
+ lmf = *addr;
+
tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = domain;
tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = jit_tls;
mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) MONO_INTERNAL;
gboolean
-mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle) MONO_INTERNAL;
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info) MONO_INTERNAL;
/* Exception handling */
typedef struct {
void (*setup_async_callback) (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
gboolean (*thread_state_init_from_sigctx) (MonoThreadUnwindState *state, void *sigctx);
- gboolean (*thread_state_init_from_handle) (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle);
+ gboolean (*thread_state_init_from_handle) (MonoThreadUnwindState *tctx, MonoThreadInfo *info);
} MonoThreadInfoRuntimeCallbacks;
/*