HANDLES(THREAD_7, "GetDomainID", ves_icall_System_Threading_Thread_GetDomainID, gint32, 0, ())
HANDLES(THREAD_8, "GetName_internal(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetName_internal, MonoString, 1, (MonoInternalThread))
HANDLES(THREAD_57, "GetPriorityNative", ves_icall_System_Threading_Thread_GetPriority, int, 1, (MonoThreadObject))
-ICALL(THREAD_59, "GetStackTraces", ves_icall_System_Threading_Thread_GetStackTraces)
+HANDLES(THREAD_59, "GetStackTraces", ves_icall_System_Threading_Thread_GetStackTraces, void, 2, (MonoArrayOut, MonoArrayOut))
HANDLES(THREAD_11, "GetState(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetState, guint32, 1, (MonoInternalThread))
HANDLES(THREAD_53, "InterruptInternal", ves_icall_System_Threading_Thread_Interrupt_internal, void, 1, (MonoThreadObject))
HANDLES(THREAD_12, "JoinInternal", ves_icall_System_Threading_Thread_Join_internal, MonoBoolean, 2, (MonoThreadObject, int))
}
/* Obtain the thread dump of all threads */
-static gboolean
-mono_threads_get_thread_dump (MonoArray **out_threads, MonoArray **out_stack_frames, MonoError *error)
+void
+ves_icall_System_Threading_Thread_GetStackTraces (MonoArrayHandleOut out_threads_handle, MonoArrayHandleOut out_stack_frames_handle, MonoError *error)
{
+ MonoStackFrameHandle stack_frame_handle = MONO_HANDLE_NEW (MonoStackFrame, NULL);
+ MonoReflectionMethodHandle reflection_method_handle = MONO_HANDLE_NEW (MonoReflectionMethod, NULL);
+ MonoStringHandle filename_handle = MONO_HANDLE_NEW (MonoString, NULL);
+ MonoArrayHandle thread_frames_handle = MONO_HANDLE_NEW (MonoArray, NULL);
ThreadDumpUserData ud;
guint32 thread_array [128];
MonoDomain *domain = mono_domain_get ();
MonoDebugSourceLocation *location;
int tindex, nthreads;
-
- error_init (error);
- *out_threads = NULL;
- *out_stack_frames = NULL;
+ MonoArray* out_threads = NULL;
+ MonoArray* out_stack_frames = NULL;
+
+ MONO_HANDLE_ASSIGN_RAW (out_threads_handle, NULL);
+ MONO_HANDLE_ASSIGN_RAW (out_stack_frames_handle, NULL);
/* Make a copy of the threads hash to avoid doing work inside threads_lock () */
nthreads = collect_threads (thread_array, 128);
ud.frames = g_new0 (MonoStackFrameInfo, 256);
ud.max_frames = 256;
- *out_threads = mono_array_new_checked (domain, mono_defaults.thread_class, nthreads, error);
+ out_threads = mono_array_new_checked (domain, mono_defaults.thread_class, nthreads, error);
goto_if_nok (error, leave);
- *out_stack_frames = mono_array_new_checked (domain, mono_defaults.array_class, nthreads, error);
+ MONO_HANDLE_ASSIGN_RAW (out_threads_handle, out_threads);
+ out_stack_frames = mono_array_new_checked (domain, mono_defaults.array_class, nthreads, error);
goto_if_nok (error, leave);
+ MONO_HANDLE_ASSIGN_RAW (out_stack_frames_handle, out_stack_frames);
for (tindex = 0; tindex < nthreads; ++tindex) {
+
guint32 handle = thread_array [tindex];
MonoInternalThread *thread = (MonoInternalThread *) mono_gchandle_get_target_internal (handle);
mono_thread_info_safe_suspend_and_run (thread_get_tid (thread), FALSE, get_thread_dump, &ud);
}
- mono_array_setref_fast (*out_threads, tindex, mono_thread_current_for_thread (thread));
+ mono_array_setref_fast (out_threads, tindex, mono_thread_current_for_thread (thread));
thread_frames = mono_array_new_checked (domain, mono_defaults.stack_frame_class, ud.nframes, error);
+ MONO_HANDLE_ASSIGN_RAW (thread_frames_handle, thread_frames);
goto_if_nok (error, leave);
- mono_array_setref_fast (*out_stack_frames, tindex, thread_frames);
+ mono_array_setref_fast (out_stack_frames, tindex, thread_frames);
for (i = 0; i < ud.nframes; ++i) {
MonoStackFrameInfo *frame = &ud.frames [i];
MonoMethod *method = NULL;
MonoStackFrame *sf = (MonoStackFrame *)mono_object_new_checked (domain, mono_defaults.stack_frame_class, error);
+ MONO_HANDLE_ASSIGN_RAW (stack_frame_handle, sf);
goto_if_nok (error, leave);
sf->native_offset = frame->native_offset;
sf->method_address = (gsize) frame->ji->code_start;
MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, NULL, error);
+ MONO_HANDLE_ASSIGN_RAW (reflection_method_handle, rm);
goto_if_nok (error, leave);
MONO_OBJECT_SETREF_INTERNAL (sf, method, rm);
if (location->source_file) {
MonoString *filename = mono_string_new_checked (domain, location->source_file, error);
+ MONO_HANDLE_ASSIGN_RAW (filename_handle, filename);
goto_if_nok (error, leave);
MONO_OBJECT_SETREF_INTERNAL (sf, filename, filename);
sf->line = location->row;
leave:
g_free (ud.frames);
- return is_ok (error);
}
/**
}
}
-void
-ves_icall_System_Threading_Thread_GetStackTraces (MonoArray **out_threads, MonoArray **out_stack_traces)
-{
- ERROR_DECL (error);
- mono_threads_get_thread_dump (out_threads, out_stack_traces, error);
- mono_error_set_pending_exception (error);
-}
-
/*
* mono_threads_attach_coop_internal: called by native->managed wrappers
*