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

  Changed paths:
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/shell/CMakeLists.txt
    M Source/JavaScriptCore/wasm/debugger/RWI_ARCHITECTURE.md
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.cpp
    M Source/JavaScriptCore/wasm/debugger/WasmDebugServer.h
    A Source/JavaScriptCore/wasm/debugger/WasmGDBPacketParser.cpp
    A Source/JavaScriptCore/wasm/debugger/WasmGDBPacketParser.h
    A Source/JavaScriptCore/wasm/debugger/tests/GDBPacketParserTest.cpp
    A Source/JavaScriptCore/wasm/debugger/tests/GDBPacketParserTest.h
    M Source/JavaScriptCore/wasm/debugger/testwasmdebugger.cpp
    M Source/WebKit/WebProcess/Inspector/WasmDebuggerDispatcher.cpp

  Log Message:
  -----------
  [JSC][WASM][Debugger] Extract GDB packet parser to handle multi-packet recv() 
calls
https://bugs.webkit.org/show_bug.cgi?id=305540
rdar://168199542

Reviewed by Yusuke Suzuki.

recv() can return multiple packets or partial packets in a single call
(e.g., "$s#73\x03" contains both a step packet and an interrupt). The
previous implementation assumed one packet per recv(), causing missed
packets and protocol errors.

This patch extracts packet parsing into a dedicated GDBPacketParser class
implementing a byte-by-byte state machine. Both TCP socket mode and Remote
Web Inspector mode now use the same handlePacket() API after their
respective packet parsing.

Tests:
* Source/JavaScriptCore/wasm/debugger/tests/GDBPacketParserTest.cpp: Added.
(testGDBPacketParserBasic):
(testGDBPacketParserMultiPacket):
(testGDBPacketParserPartialPacket):
(testGDBPacketParserChecksumValidation):
(testGDBPacketParserInterrupt):
(testGDBPacketParserReset):
(testGDBPacketParserBufferOverflow):
(testGDBPacketParserMalformedPackets):
(testGDBPacketParserInvalidHexChecksum):
(testGDBPacketParserErrorStateGuard):
(testGDBPacketParserEmptyPayload):
(testGDBPacketParserConsecutivePackets):
(testGDBPacketParserMultipleInterrupts):
(testGDBPacketParserEdgeSizePayloads):

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



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

Reply via email to