From 4eda1d7fe2a627554f997c5d2ac159e2bfcf8bd5 Mon Sep 17 00:00:00 2001 From: monojenkins Date: Thu, 9 Apr 2020 03:58:26 -0400 Subject: [PATCH] Wasm debug log level (#34723) enable_debugging was already an int, with this change log_level will remain at 1 by default but passing -1 will disable the log spew Co-authored-by: lewing --- src/mono/mono/mini/mini-wasm-debugger.c | 9 +++++---- src/mono/mono/mini/mini-wasm.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mono/mono/mini/mini-wasm-debugger.c b/src/mono/mono/mini/mini-wasm-debugger.c index 3d8aa0eb032..737028ff611 100644 --- a/src/mono/mono/mini/mini-wasm-debugger.c +++ b/src/mono/mono/mini/mini-wasm-debugger.c @@ -119,7 +119,7 @@ collect_frames (MonoStackFrameInfo *info, MonoContext *ctx, gpointer data) DEBUG_PRINTF (2, "Reporting method %s native_offset %d\n", method->name, info->native_offset); if (!mono_find_prev_seq_point_for_native_offset (mono_get_root_domain (), method, info->native_offset, NULL, &sp)) - DEBUG_PRINTF (1, "Failed to lookup sequence point\n"); + DEBUG_PRINTF (2, "Failed to lookup sequence point\n"); DbgEngineStackFrame *frame = g_new0 (DbgEngineStackFrame, 1); @@ -335,7 +335,7 @@ mono_wasm_debugger_init (void) mono_debug_init (MONO_DEBUG_FORMAT_MONO); mono_de_init (&cbs); - mono_de_set_log_level (1, stdout); + mono_de_set_log_level (log_level, stdout); mini_debug_options.gen_sdb_seq_points = TRUE; mini_debug_options.mdb_optimizations = TRUE; @@ -352,10 +352,11 @@ mono_wasm_debugger_init (void) } MONO_API void -mono_wasm_enable_debugging (void) +mono_wasm_enable_debugging (int debug_level) { DEBUG_PRINTF (1, "DEBUGGING ENABLED\n"); debugger_enabled = TRUE; + log_level = debug_level; } EMSCRIPTEN_KEEPALIVE int @@ -363,7 +364,7 @@ mono_wasm_setup_single_step (int kind) { int nmodifiers = 1; - printf (">>>> mono_wasm_setup_single_step %d\n", kind); + DEBUG_PRINTF (2, ">>>> mono_wasm_setup_single_step %d\n", kind); EventRequest *req = (EventRequest *)g_malloc0 (sizeof (EventRequest) + (nmodifiers * sizeof (Modifier))); req->id = ++event_request_id; req->event_kind = EVENT_KIND_STEP; diff --git a/src/mono/mono/mini/mini-wasm.h b/src/mono/mono/mini/mini-wasm.h index aa64fa89c74..cdc5e8131e3 100644 --- a/src/mono/mono/mini/mini-wasm.h +++ b/src/mono/mono/mini/mini-wasm.h @@ -104,7 +104,7 @@ typedef struct { void mono_wasm_debugger_init (void); // sdks/wasm/driver.c is C and uses this -G_EXTERN_C void mono_wasm_enable_debugging (void); +G_EXTERN_C void mono_wasm_enable_debugging (int log_level); void mono_wasm_breakpoint_hit (void); void mono_wasm_set_timeout (int timeout, int id); -- 2.34.1