Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/GDBRemoteProtocol/GDBHostCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ package struct GDBHostCommand: Equatable {
case removeSoftwareBreakpoint
case wasmLocal
case memoryRegionInfo
case detach

case generalRegisters

Expand Down Expand Up @@ -103,6 +104,8 @@ package struct GDBHostCommand: Equatable {
self = .wasmLocal
case "qMemoryRegionInfo":
self = .memoryRegionInfo
case "D":
self = .detach

default:
return nil
Expand Down
3 changes: 2 additions & 1 deletion Sources/WasmKit/Execution/Debugger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
/// Threading model of the Wasm engine configuration, cached for a potentially hot path.
private let threadingModel: EngineConfiguration.ThreadingModel

private(set) var breakpoints = [Int: CodeSlot]()
/// Mapping from a Wasm address of a breakpoint to a corresponding iseq code slot.
package private(set) var breakpoints = [Int: UInt64]()

package private(set) var state: State

Expand Down
8 changes: 8 additions & 0 deletions Sources/WasmKitGDBHandler/WasmKitGDBHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@
case .kill:
throw Error.killRequestReceived

case .detach:
for address in self.debugger.breakpoints.keys {
try self.debugger.disableBreakpoint(address: address)
}

try self.debugger.run()
throw Error.killRequestReceived

case .insertSoftwareBreakpoint:
try self.debugger.enableBreakpoint(
address: Int(
Expand Down