Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e51159c6bbedb25e0e9eeb217917dce4eb7bf327
      
https://github.com/WebKit/WebKit/commit/e51159c6bbedb25e0e9eeb217917dce4eb7bf327
  Author: Yijia Huang <[email protected]>
  Date:   2026-01-06 (Tue, 06 Jan 2026)

  Changed paths:
    M JSTests/wasm/debugger/lib/core/base.py
    A 
JSTests/wasm/debugger/resources/wasm/multi-vm-same-module-different-funcs.js
    A JSTests/wasm/debugger/resources/wasm/multi-vm-same-module-same-func.js
    A JSTests/wasm/debugger/resources/wasm/system-call.js
    M JSTests/wasm/debugger/test-wasm-debugger.py
    M JSTests/wasm/debugger/tests/tests.py
    M Source/JavaScriptCore/API/tests/VMManagerStopTheWorldTest.cpp
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/llint/InPlaceInterpreter.asm
    M Source/JavaScriptCore/runtime/InitializeThreading.cpp
    M Source/JavaScriptCore/runtime/JSCConfig.h
    M Source/JavaScriptCore/runtime/Options.cpp
    M Source/JavaScriptCore/runtime/StopTheWorldCallback.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/runtime/VMManager.cpp
    M Source/JavaScriptCore/runtime/VMManager.h
    M Source/JavaScriptCore/shell/CMakeLists.txt
    M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmInstanceAnchor.h
    A Source/JavaScriptCore/wasm/debugger/Debugger-Mutator-Protocol.md
    M Source/JavaScriptCore/wasm/debugger/README.md
    M Source/JavaScriptCore/wasm/debugger/RWI_ARCHITECTURE.md
    M Source/JavaScriptCore/wasm/debugger/WasmBreakpointManager.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmBreakpointManager.h
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.h
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServerUtilities.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServerUtilities.h
    M Source/JavaScriptCore/wasm/debugger/WasmExecutionHandler.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmExecutionHandler.h
    M Source/JavaScriptCore/wasm/debugger/WasmModuleManager.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmModuleManager.h
    M Source/JavaScriptCore/wasm/debugger/WasmQueryHandler.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmVirtualAddress.h
    A Source/JavaScriptCore/wasm/debugger/tests/ExecutionHandlerTest.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/ExecutionHandlerTest.h
    A Source/JavaScriptCore/wasm/debugger/tests/ExecutionHandlerTestSupport.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/ExecutionHandlerTestSupport.h
    A Source/JavaScriptCore/wasm/debugger/tests/TestScripts.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/TestScripts.h
    M Source/JavaScriptCore/wasm/debugger/tests/TestUtilities.cpp
    M Source/JavaScriptCore/wasm/debugger/testwasmdebugger.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp
    M Source/WebKit/WebProcess/WebProcess.cpp

  Log Message:
  -----------
  [JSC][Wasm][Debugger] Implement multi-VM stop-the-world debugging
https://bugs.webkit.org/show_bug.cgi?id=302699
rdar://164945623

Reviewed by Keith Miller.

Implements comprehensive multi-VM stop-the-world Wasm debugger that stops ALL 
VMs
in the process when any VM hits a breakpoint or receives an interrupt.

Architecture:

* VMManager world modes coordinate multi-VM execution:
    - Running: Normal execution (all VMs running).
    - Stopped: All VMs paused at safe points for inspection.
    - RunOne: Single-step mode (target VM runs, others stopped).

* Two-phase callback system:
    - wasmDebuggerOnStop(): VMManager calls with ALL VMs stopped; returns 
resume mode.
    - wasmDebuggerOnResume(): VMManager calls after ALL VMs resume; releases 
barriers.

* Per-VM DebugState tracks execution state:
    - Running vs Stopped with stop reason (Prologue/Breakpoint/SystemCall).
    - StopData snapshot: PC, locals, stack, call frame for inspection.
    - Step-into event flags for cross-function stepping (call/throw).

* ExecutionHandler bridges LLDB commands to VM execution:
    - Detailed design in Debugger-Mutator-Protocol.md.
    - Two condition variables orchestrate debugger-mutator communication.
    - State machine 
(Replied/InterruptRequested/ContinueRequested/StepRequested/SwitchRequested).
    - Resume barrier prevents overlapping stop-the-world operations.
    - Target VM selection: prefers VM at prologue, falls back to triggering VM.

* Step-into design minimizes runtime changes:
    - step() sets event flag instead of resolving callee/handler immediately
    - Runtime resolves target naturally during execution (call dispatch, 
exception unwinding)
    - Callback sets breakpoint using resolved target, avoiding duplicate 
resolution logic
    - Reuses existing runtime mechanisms rather than duplicating complex 
resolution in debugger

Testing:

* Unit tests: ExecutionHandlerTest validates coordination logic.
* Integration tests: multi-vm test cases for same/different modules and 
functions.

Note that the WebAssembly debugger currently supports ARM64 platforms only.

Canonical link: https://commits.webkit.org/305160@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to