Skip to content

Fix debugger to attribute breakpoint stops correctly - #382

Open
MaxDesiatov wants to merge 1 commit into
mainfrom
maxd/lldb-requested-address
Open

Fix debugger to attribute breakpoint stops correctly#382
MaxDesiatov wants to merge 1 commit into
mainfrom
maxd/lldb-requested-address

Conversation

@MaxDesiatov

Copy link
Copy Markdown
Member

The handler reported every stop as reason:trace at the resolved instruction, so LLDB mapped hits to eStopReasonTrace and never attributed them to a breakpoint. It now tracks each host-requested address, replies with reason:breakpoint at that address on a real hit while keeping step and entrypoint landings as trace, and removes breakpoints at their resolved address. Added a WasmKitGDBHandlerTests target covering the stop reason, reported address, and removal.

@MaxDesiatov MaxDesiatov added the wasm debugging Support for debugging of executed Wasm label Jul 21, 2026
@MaxDesiatov MaxDesiatov changed the title Fix debugger to attribute breakpoint stops at the host-requested address Fix debugger to attribute breakpoint stops correctly Jul 21, 2026
@MaxDesiatov
MaxDesiatov force-pushed the maxd/lldb-requested-address branch 2 times, most recently from 2f5a18c to 7ff9258 Compare July 22, 2026 20:54
// Requested and resolved addresses diverge when the requested address lands on an elided
// instruction (e.g. local.get) that resolves forward; the host expects stop replies at the
// address it set the breakpoint on, not the resolved one.
private var resolvedToRequestedBreakpoint = [Int: Int]()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this smells a bit. Don't we already track the same state in Debugger?

The handler reported every stop as `reason:trace` at the resolved instruction, so LLDB mapped hits to `eStopReasonTrace` and never attributed them to a breakpoint. It now tracks each host-requested address, replies with `reason:breakpoint` at that address on a real hit while keeping step and entrypoint landings as `trace`, and removes breakpoints at their resolved address. Added a `WasmKitGDBHandlerTests` target covering the stop reason, reported address, and removal.

# Conflicts:
#	Tests/WasmKitGDBHandlerTests/WasmKitGDBHandlerTests.swift
@MaxDesiatov
MaxDesiatov force-pushed the maxd/lldb-requested-address branch from 7ff9258 to 00bacc8 Compare July 23, 2026 13:45
@kateinoigakukun
kateinoigakukun added this pull request to the merge queue Jul 26, 2026
@kateinoigakukun
kateinoigakukun removed this pull request from the merge queue due to a manual request Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug wasm debugging Support for debugging of executed Wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants