Skip to content

Commit

Permalink
mono_wasm_print_thread_dump
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Mar 14, 2024
1 parent 3a7a5e7 commit 7020bf6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/mono/browser/runtime/cwraps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const threading_cwraps: SigLine[] = WasmEnableThreads ? [
[true, "mono_wasm_create_io_thread", "number", []],
[true, "mono_wasm_register_ui_thread", "void", []],
[true, "mono_wasm_register_io_thread", "void", []],
[true, "mono_wasm_print_thread_dump", "void", []],
] : [];

// when the method is assigned/cached at usage, instead of being invoked directly from cwraps, it can't be marked lazy, because it would be re-bound on each call
Expand Down Expand Up @@ -154,6 +155,7 @@ export interface t_ThreadingCwraps {
mono_wasm_create_io_thread(): PThreadPtr;
mono_wasm_register_ui_thread(): void;
mono_wasm_register_io_thread(): void;
mono_wasm_print_thread_dump(): void;
}

export interface t_ProfilerCwraps {
Expand Down
7 changes: 7 additions & 0 deletions src/mono/browser/runtime/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ mono_wasm_invoke_jsexport (MonoMethod *method, void* args)

extern void mono_threads_wasm_async_run_in_target_thread_vii (void* target_thread, void (*func) (gpointer, gpointer), gpointer user_data1, gpointer user_data2);
extern void mono_threads_wasm_sync_run_in_target_thread_vii (void* target_thread, void (*func) (gpointer, gpointer), gpointer user_data1, gpointer user_data2);
extern void mono_print_thread_dump (void *sigctx);

EMSCRIPTEN_KEEPALIVE void
mono_wasm_print_thread_dump (void)
{
mono_print_thread_dump (NULL);
}

// this is running on the target thread
static void
Expand Down
3 changes: 2 additions & 1 deletion src/mono/browser/runtime/exports-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import WasmEnableThreads from "consts:wasmEnableThreads";

import { MonoObjectNull, type MonoObject } from "./types/internal";
import cwraps, { profiler_c_functions } from "./cwraps";
import cwraps, { profiler_c_functions, threads_c_functions as twraps } from "./cwraps";
import { mono_wasm_send_dbg_command_with_parms, mono_wasm_send_dbg_command, mono_wasm_get_dbg_command_info, mono_wasm_get_details, mono_wasm_release_object, mono_wasm_call_function_on, mono_wasm_debugger_resume, mono_wasm_detach_debugger, mono_wasm_raise_debug_event, mono_wasm_change_debugger_log_level, mono_wasm_debugger_attached } from "./debug";
import { http_wasm_supports_streaming_request, http_wasm_supports_streaming_response, http_wasm_create_controller, http_wasm_abort_request, http_wasm_abort_response, http_wasm_transform_stream_write, http_wasm_transform_stream_close, http_wasm_fetch, http_wasm_fetch_stream, http_wasm_fetch_bytes, http_wasm_get_response_header_names, http_wasm_get_response_header_values, http_wasm_get_response_bytes, http_wasm_get_response_length, http_wasm_get_streamed_response_bytes, http_wasm_get_response_type, http_wasm_get_response_status } from "./http";
import { exportedRuntimeAPI, Module, runtimeHelpers } from "./globals";
Expand Down Expand Up @@ -119,6 +119,7 @@ export function cwraps_internal(internal: any): void {
mono_wasm_profiler_init_aot: profiler_c_functions.mono_wasm_profiler_init_aot,
mono_wasm_profiler_init_browser: profiler_c_functions.mono_wasm_profiler_init_browser,
mono_wasm_exec_regression: cwraps.mono_wasm_exec_regression,
mono_wasm_print_thread_dump: WasmEnableThreads ? twraps.mono_wasm_print_thread_dump : undefined,
});
}

Expand Down

0 comments on commit 7020bf6

Please sign in to comment.