Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7bf4dbaedeed630919f673e7822168ff3d1c003f
      
https://github.com/WebKit/WebKit/commit/7bf4dbaedeed630919f673e7822168ff3d1c003f
  Author: Yijia Huang <[email protected]>
  Date:   2025-11-03 (Mon, 03 Nov 2025)

  Changed paths:
    M JSTests/wasm/debugger/lib/core/base.py
    A JSTests/wasm/debugger/resources/wasm/call-indirect.js
    A JSTests/wasm/debugger/resources/wasm/call-ref.js
    A JSTests/wasm/debugger/resources/wasm/call.js
    A JSTests/wasm/debugger/resources/wasm/delegate.js
    A JSTests/wasm/debugger/resources/wasm/nop-drop-select-end.js
    A JSTests/wasm/debugger/resources/wasm/rethrow.js
    A JSTests/wasm/debugger/resources/wasm/return-call-indirect.js
    A JSTests/wasm/debugger/resources/wasm/return-call-ref.js
    A JSTests/wasm/debugger/resources/wasm/return-call.js
    A JSTests/wasm/debugger/resources/wasm/throw-catch-all.js
    A JSTests/wasm/debugger/resources/wasm/throw-catch.js
    A JSTests/wasm/debugger/resources/wasm/throw-ref.js
    A JSTests/wasm/debugger/resources/wasm/try-table.js
    A JSTests/wasm/debugger/resources/wasm/wat2wasm.js
    M JSTests/wasm/debugger/tests/tests.py
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/shell/CMakeLists.txt
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.h
    M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmPlan.h
    M Source/JavaScriptCore/wasm/debugger/README.md
    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/WasmMemoryHandler.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmModuleDebugInfo.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmModuleDebugInfo.h
    A Source/JavaScriptCore/wasm/debugger/tests/BinaryTests.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/ControlFlowTests.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/ExtGCTests.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/MemoryTests.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/SpecialTests.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/TestUtilities.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/TestUtilities.h
    A Source/JavaScriptCore/wasm/debugger/tests/UnaryTests.cpp
    M Source/JavaScriptCore/wasm/debugger/testwasmdebugger.cpp
    M Source/JavaScriptCore/wasm/generateWasmOpsHeader.py

  Log Message:
  -----------
  [JSC] Add WebAssembly debugger step-into support for calls and exception 
handling
rdar://163724778
https://bugs.webkit.org/show_bug.cgi?id=301704

Reviewed by Yusuke Suzuki.

This patch implements step-into functionality for the WebAssembly debugger,
allowing developers to step into function calls and exception handlers when
debugging WebAssembly code in IPInt mode.

Implementation approach:
- Introduced StepIntoEvent flag mechanism in VM to coordinate between the
  debugger (step command) and code execution (call/throw slow paths)
- When stepping on a call instruction, the debugger sets a flag in the VM
- When the call executes in prepare_call*, the flag is consumed and a
  breakpoint is set at the callee entry (if the target is IPInt)
- Similar mechanism for throw instructions - flag is set on step, consumed
  when exception handler is determined by genericUnwind()

Key changes:
- VM: Added StepIntoEvent member with take/set methods for Call and Throw events
- DebugServer: New setStepIntoBreakpointForCall() and 
setStepIntoBreakpointForThrow()
  methods that consume flags and conditionally set breakpoints
- WasmIPIntSlowPaths: Added IPINT_HANDLE_STEP_INTO_CALL macro called in all
  prepare_call* functions, and IPINT_HANDLE_STEP_INTO_THROW macro called in
  all throw/rethrow/throw_ref functions
- ExecutionHandler: Simplified step() implementation to use debug info for
  control flow, and use flag-based approach for calls/throws instead of
  manually analyzing metadata

Test Coverage:
- Unit tests: OpType opcodes (FOR_EACH_WASM_*_OP macros)
- Runtime tests: Integration tests covering step-into/over/out
  - Exception handling: throw-catch, throw-catch-all, rethrow, throw-ref, 
delegate, try-table
  - Function calls: call, call-indirect, call-ref
  - Tail calls: return-call, return-call-indirect, return-call-ref

Future Work:
  - Extended opcode families (Ext1OpType, ExtGCOpType, ExtAtomicOpType, 
ExtSIMDOpType)

The flag-based mechanism ensures proper coordination between debugger and
execution: flags are always consumed when instructions execute (even if
target is non-IPInt compiled code), preventing flag persistence bugs.

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



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

Reply via email to