Skip to content

Commit

Permalink
Wasm debug log level (#34723)
Browse files Browse the repository at this point in the history
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 <lewing@users.noreply.github.com>
  • Loading branch information
monojenkins and lewing committed Apr 9, 2020
1 parent 7b90ab2 commit 4eda1d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/mono/mono/mini/mini-wasm-debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -352,18 +352,19 @@ 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
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;
Expand Down
2 changes: 1 addition & 1 deletion src/mono/mono/mini/mini-wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4eda1d7

Please sign in to comment.