Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e116bf50fba117f377430ed98023aaeb03fb5a78
https://github.com/WebKit/WebKit/commit/e116bf50fba117f377430ed98023aaeb03fb5a78
Author: Yijia Huang <[email protected]>
Date: 2025-10-24 (Fri, 24 Oct 2025)
Changed paths:
M JSTests/wasm/debugger/lib/core/base.py
M JSTests/wasm/debugger/lib/runners/parallel.py
M JSTests/wasm/debugger/lib/runners/sequential.py
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
M Source/JavaScriptCore/inspector/protocol/Audit.json
M Source/JavaScriptCore/inspector/protocol/Console.json
M Source/JavaScriptCore/inspector/protocol/Debugger.json
M Source/JavaScriptCore/inspector/protocol/Heap.json
M Source/JavaScriptCore/inspector/protocol/Inspector.json
M Source/JavaScriptCore/inspector/protocol/Runtime.json
M Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json
M Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
M Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h
M Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h
M Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm
M Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
M Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorSocket.cpp
M Source/JavaScriptCore/inspector/scripts/codegen/models.py
M Source/JavaScriptCore/jsc.cpp
M Source/JavaScriptCore/runtime/Options.cpp
M Source/JavaScriptCore/wasm/debugger/README.md
A Source/JavaScriptCore/wasm/debugger/RWI_ARCHITECTURE.md
M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.cpp
M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.h
M Source/JavaScriptCore/wasm/debugger/WasmDebugServerUtilities.h
M Source/JavaScriptCore/wasm/debugger/WasmExecutionHandler.cpp
M Source/JavaScriptCore/wasm/debugger/WasmExecutionHandler.h
M Source/WebCore/inspector/InspectorDebuggableType.h
M Source/WebCore/inspector/InspectorFrontendHost.cpp
M Source/WebKit/CMakeLists.txt
M Source/WebKit/DerivedSources-input.xcfilelist
M Source/WebKit/DerivedSources-output.xcfilelist
M Source/WebKit/DerivedSources.make
M Source/WebKit/Shared/DebuggableInfoData.serialization.in
M Source/WebKit/Sources.txt
M Source/WebKit/SourcesCocoa.txt
M Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h
M Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDebuggableInfoInternal.h
A Source/WebKit/UIProcess/Inspector/WasmDebuggerDebuggable.cpp
A Source/WebKit/UIProcess/Inspector/WasmDebuggerDebuggable.h
M
Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp
M Source/WebKit/UIProcess/WebProcessProxy.cpp
M Source/WebKit/UIProcess/WebProcessProxy.h
M Source/WebKit/UIProcess/WebProcessProxy.messages.in
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
A Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.cpp
A Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.h
A Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.messages.in
M Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
M Source/WebKit/WebProcess/WebProcess.cpp
M Source/WebKit/WebProcess/WebProcess.h
Log Message:
-----------
Add WebAssembly debugging support via Remote Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=300668
rdar://162564731
Reviewed by Devin Rousso and BJ Burg.
This patch integrates WebAssembly debugging with WebKit's Remote Web Inspector
(RWI) infrastructure, enabling LLDB debugging of WebAssembly code running in
WebContent processes.
Architecture:
1. Process-wide singleton: One WasmDebugServer per WebContent process manages
all Wasm modules
2. WorkQueue-based IPC: Debug commands processed on background thread, enabling
debugging when main thread is blocked in infinite loops
3. Dual-mode operation: Debug server supports both standalone TCP mode (JSC
shell)
and RWI mode (WebKit)
Key Changes:
WebAssembly Debugging Infrastructure:
- Added WasmDebuggerDebuggable (UI Process RWI target with OS PID in display
name)
- Added WasmDebuggerDispatcher (WebContent Process WorkQueue-based IPC receiver)
- Updated WebProcessProxy to create/manage WebAssembly debugging targets
- Guarded RWI-specific code with ENABLE(REMOTE_INSPECTOR) feature flag
RWI Protocol Support:
- Add WasmDebugger to DebuggableType and TargetType enums in the RWI framework
- Add WasmDebugger case to DirectBackendTarget for protocol connection handling
- Add "WebAssembly Debugger" localized string
- Update protocol JSON files to include "wasm-debugger" in debuggableTypes and
targetTypes
for 7 domains: Audit, Console, Debugger, Heap, Inspector, Runtime, and
ScriptProfiler
Process Lifetime Semantics:
Unlike Web Inspector which has per-page lifecycle, Wasm debugging runs for the
entire process lifetime. The debug server starts with the WebContent process and
continues running regardless of RWI connection state.
Naming Convention:
WasmDebugger is used throughout to distinguish the JSC Wasm Debugger server
(standalone debugging target) from future general WebAssembly debugging in web
pages, which will use normal Page/Frame targets.
Documentation:
1. Source/JavaScriptCore/wasm/debugger/README.md: Debug server implementation
with protocol details and testing
2. Source/JavaScriptCore/wasm/debugger/RWI_ARCHITECTURE.md: RWI integration
architecture and design rationale
Testing:
No new tests added. RWI mode testing requires full integration with
webinspectord,
WebAssemblyRWIClient (external relay app), and LLDB. Core debugging logic is
already
tested by JSTests/wasm/debugger in standalone TCP mode. This patch adds RWI
integration plumbing (IPC, WorkQueue, target registration) using the same tested
WasmDebugServer core.
* Source/JavaScriptCore/inspector/InspectorTarget.h:
* Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h:
* Source/WebCore/inspector/InspectorDebuggableType.h:
Add InspectorTargetType::WasmDebugger and DebuggableType::WasmDebugger with
explanatory comments.
* Source/JavaScriptCore/inspector/protocol/Audit.json:
* Source/JavaScriptCore/inspector/protocol/Console.json:
* Source/JavaScriptCore/inspector/protocol/Debugger.json:
* Source/JavaScriptCore/inspector/protocol/Heap.json:
* Source/JavaScriptCore/inspector/protocol/Inspector.json:
* Source/JavaScriptCore/inspector/protocol/Runtime.json:
* Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json:
Add "wasm-debugger" to debuggableTypes and targetTypes arrays.
* Source/JavaScriptCore/inspector/protocol/Target.json:
Add "wasm-debugger" to targetTypes array.
* Source/JavaScriptCore/inspector/scripts/codegen/models.py:
Update protocol code generator to recognize "wasm-debugger" debuggable type.
* Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h:
* Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm:
* Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp:
* Source/JavaScriptCore/inspector/agents/InspectorTargetAgent.cpp:
Update RWI constants and target agent to handle WasmDebugger type.
* Source/JavaScriptCore/wasm/debugger/WasmDebugServer.h:
* Source/JavaScriptCore/wasm/debugger/WasmDebugServer.cpp:
* Source/JavaScriptCore/wasm/debugger/WasmExecutionHandler.cpp:
Guard RWI-specific functionality (startRWI, isRWIMode, m_rwiResponseHandler)
with ENABLE(REMOTE_INSPECTOR) to reduce code size when feature is disabled.
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
Add "WebAssembly Debugger" localized string.
* Source/WebInspectorUI/UserInterface/Base/DebuggableType.js:
Add WasmDebugger debuggable type with fromString() and supportedTargetTypes()
support.
* Source/WebInspectorUI/UserInterface/Base/TargetType.js:
Add WasmDebugger target type.
* Source/WebInspectorUI/UserInterface/Protocol/DirectBackendTarget.js:
(WI.DirectBackendTarget.connectionInfoForDebuggable):
Add WasmDebugger case to return correct target type and display name for RWI
connections.
* Source/WebKit/Shared/DebuggableInfoData.serialization.in:
Add DebuggableType::WasmDebugger to serialization format.
* Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDebuggableInfo.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKInspectorDebuggableInfoInternal.h:
Add _WKInspectorDebuggableTypeWasmDebugger to Cocoa API.
* Source/WebKit/UIProcess/Inspector/WasmDebuggerDebuggable.h:
* Source/WebKit/UIProcess/Inspector/WasmDebuggerDebuggable.cpp:
New files implementing WebAssembly debuggable target for RWI.
* Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.h:
* Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.cpp:
* Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.messages.in:
New files implementing WorkQueue-based IPC message handling for WebAssembly
debugging.
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebProcessProxy.cpp:
* Source/WebKit/UIProcess/WebProcessProxy.messages.in:
Add WebAssembly debugging target management and IPC message forwarding.
* Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp:
Handle WasmDebugger debuggable type in socket-based RWI protocol handler.
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.cpp:
Initialize WasmDebuggerDispatcher and start WasmDebugServer in RWI mode.
* JSTests/wasm/debugger/lib/core/base.py:
* JSTests/wasm/debugger/lib/runners/parallel.py:
* JSTests/wasm/debugger/lib/runners/sequential.py:
Update test infrastructure to use --wasm-debugger flag.
* Source/JavaScriptCore/jsc.cpp:
Update JSC shell to use --wasm-debugger flag for consistency.
* Source/JavaScriptCore/wasm/debugger/README.md:
* Source/JavaScriptCore/wasm/debugger/RWI_ARCHITECTURE.md:
Add comprehensive documentation for debug server implementation and RWI
integration.
Canonical link: https://commits.webkit.org/302126@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications