| 
30 | 30 |     extension Instance {  | 
31 | 31 |         /// Return an address of WasmKit's iseq bytecode instruction that matches a given Wasm instruction address.  | 
32 | 32 |         /// - Parameter address: the Wasm instruction to find a mapping for.  | 
33 |  | -        /// - Returns: A tuple with an address of found iseq instruction and the closests matching Wasm instruction  | 
34 |  | -        /// if no direct match was found.  | 
 | 33 | +        /// - Returns: A tuple with an address of found iseq instruction and the original Wasm instruction or next   | 
 | 34 | +        /// closest match if no direct match was found.  | 
35 | 35 |         fileprivate func findIseq(forWasmAddress address: Int) throws(Debugger.Error) -> (iseq: Pc, wasm: Int) {  | 
36 | 36 |             // Look in the main mapping  | 
37 | 37 |             if let iseq = handle.wasmToIseqMapping[address] {  | 
 | 
50 | 50 |         }  | 
51 | 51 |     }  | 
52 | 52 | 
 
  | 
53 |  | -    /// User-facing debugger state that driven by a debugger host. This implementation has no knowledge of the exact  | 
 | 53 | +    /// User-facing debugger state driven by a debugger host. This implementation has no knowledge of the exact  | 
54 | 54 |     /// debugger protocol, which allows any protocol implementation or direct API users to be layered on top if needed.  | 
55 | 55 |     package struct Debugger: ~Copyable {  | 
56 | 56 |         package enum Error: Swift.Error, @unchecked Sendable {  | 
 | 
71 | 71 |         private let instance: Instance  | 
72 | 72 | 
 
  | 
73 | 73 |         /// Reference to the entrypoint function of the currently debugged module, for use in ``stopAtEntrypoint``.  | 
 | 74 | +        /// Currently assumed to be the WASI command `_start` entrypoint.  | 
74 | 75 |         private let entrypointFunction: Function  | 
75 | 76 | 
 
  | 
76 |  | -        /// Threading model of the Wasm engine configuration cached for a potentially hot path.  | 
 | 77 | +        /// Threading model of the Wasm engine configuration, cached for a potentially hot path.  | 
77 | 78 |         private let threadingModel: EngineConfiguration.ThreadingModel  | 
78 | 79 | 
 
  | 
79 | 80 |         private(set) var breakpoints = [Int: CodeSlot]()  | 
 | 
112 | 113 |         }  | 
113 | 114 | 
 
  | 
114 | 115 |         /// Finds a Wasm address for the first instruction in a given function.  | 
115 |  | -        /// - Parameter function: the Wasm function to find a Wasm address for.  | 
 | 116 | +        /// - Parameter function: the Wasm function to find the first Wasm instruction address for.  | 
116 | 117 |         /// - Returns: byte offset of the first Wasm instruction of given function in the module it was parsed from.  | 
117 | 118 |         private func originalAddress(function: Function) throws -> Int {  | 
118 | 119 |             precondition(function.handle.isWasm)  | 
 | 
128 | 129 |             }  | 
129 | 130 |         }  | 
130 | 131 | 
 
  | 
131 |  | -        /// Enable a breakpoint at a given Wasm address.  | 
 | 132 | +        /// Enables a breakpoint at a given Wasm address.  | 
132 | 133 |         /// - Parameter address: byte offset of the Wasm instruction that will be replaced with a breakpoint. If no  | 
133 | 134 |         /// direct internal bytecode matching instruction is found, the next closest internal bytecode instruction  | 
134 |  | -        /// is replaced with a breakpoint. The original instruction to be restored is preserved in debugger state.  | 
 | 135 | +        /// is replaced with a breakpoint. The original instruction to be restored is preserved in debugger state  | 
 | 136 | +        /// represented by `self`.  | 
135 | 137 |         /// See also ``Debugger/disableBreakpoint(address:)``.  | 
136 | 138 |         package mutating func enableBreakpoint(address: Int) throws(Error) {  | 
137 | 139 |             guard self.breakpoints[address] == nil else {  | 
 | 
0 commit comments