Skip to content

Commit 83b7763

Browse files
authored
feat: initialize debugger on first call (#237)
This enables using content debugger for scripts that don't target wasi/http. Depending on how StarlingMonkey has been configured, `maybe_init_debugger` can be a nop or perform actual debugger initialization. There is currently a triple line of defense to prevent accidental debugger initialization: - StarlingMonkey build must be configured with ENABLE_JS_DEBUGGER=ON - StarlingMonkey runtime arguments must include the `--enable-script-debugging` option - The environment variable DEBUGGER_PORT must be defined
1 parent 73eb294 commit 83b7763

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

embedding/embedding.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "embedding.h"
2+
#include "debugger.h"
23
#include "builtins/web/performance.h"
34

45
namespace builtins::web::console {
@@ -147,6 +148,7 @@ cabi_realloc(void *ptr, size_t orig_size, size_t org_align, size_t new_size) {
147148
__attribute__((export_name("call"))) uint32_t call(uint32_t fn_idx,
148149
void *argptr) {
149150
if (Runtime.first_call) {
151+
content_debugger::maybe_init_debugger(Runtime.engine, true);
150152
js::ResetMathRandomSeed(Runtime.cx);
151153
Runtime.first_call = false;
152154
if (Runtime.clocks) {

0 commit comments

Comments
 (0)