Skip to content

Commit e7a5287

Browse files
authored
Refine doc comments wording
1 parent 55bfb6b commit e7a5287

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

Sources/WasmKit/Execution/Debugger.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
extension Instance {
3131
/// Return an address of WasmKit's iseq bytecode instruction that matches a given Wasm instruction address.
3232
/// - 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.
3535
fileprivate func findIseq(forWasmAddress address: Int) throws(Debugger.Error) -> (iseq: Pc, wasm: Int) {
3636
// Look in the main mapping
3737
if let iseq = handle.wasmToIseqMapping[address] {
@@ -50,7 +50,7 @@
5050
}
5151
}
5252

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
5454
/// debugger protocol, which allows any protocol implementation or direct API users to be layered on top if needed.
5555
package struct Debugger: ~Copyable {
5656
package enum Error: Swift.Error, @unchecked Sendable {
@@ -71,9 +71,10 @@
7171
private let instance: Instance
7272

7373
/// Reference to the entrypoint function of the currently debugged module, for use in ``stopAtEntrypoint``.
74+
/// Currently assumed to be the WASI command `_start` entrypoint.
7475
private let entrypointFunction: Function
7576

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.
7778
private let threadingModel: EngineConfiguration.ThreadingModel
7879

7980
private(set) var breakpoints = [Int: CodeSlot]()
@@ -112,7 +113,7 @@
112113
}
113114

114115
/// 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.
116117
/// - Returns: byte offset of the first Wasm instruction of given function in the module it was parsed from.
117118
private func originalAddress(function: Function) throws -> Int {
118119
precondition(function.handle.isWasm)
@@ -128,10 +129,11 @@
128129
}
129130
}
130131

131-
/// Enable a breakpoint at a given Wasm address.
132+
/// Enables a breakpoint at a given Wasm address.
132133
/// - Parameter address: byte offset of the Wasm instruction that will be replaced with a breakpoint. If no
133134
/// 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`.
135137
/// See also ``Debugger/disableBreakpoint(address:)``.
136138
package mutating func enableBreakpoint(address: Int) throws(Error) {
137139
guard self.breakpoints[address] == nil else {

Sources/WasmKit/Execution/Execution.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ extension Execution {
321321

322322
#if WasmDebuggingSupport
323323

324+
/// Counterpart to the free `executeWasm` function but implemented as a method of `Execution`,
325+
/// Useful for representation of debugger state that needs to own `Execution`'s memory.
324326
mutating func executeWasm(
325327
threadingModel: EngineConfiguration.ThreadingModel,
326328
function handle: InternalFunction,

Sources/WasmKit/Execution/Instances.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ struct InstanceEntity /* : ~Copyable */ {
8585
var dataCount: UInt32?
8686
var isDebuggable: Bool
8787

88-
/// Mapping from iSeq Pc to instruction addresses in the original binary.
88+
/// Mapping from iseq Pc to instruction addresses in the original binary.
8989
/// Used for handling current call stack requests issued by a ``Debugger`` instance.
9090
var iseqToWasmMapping = [Pc: Int]()
9191

92-
/// Mapping from Wasm instruction addresses in the original binary to iSeq instruction addresses.
92+
/// Mapping from Wasm instruction addresses in the original binary to iseq instruction addresses.
9393
/// Used for handling breakpoint requests issued by a ``Debugger`` instance.
9494
var wasmToIseqMapping = [Int: Pc]()
9595

Sources/WasmKit/Module.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public struct Module {
139139
}
140140

141141
#if WasmDebuggingSupport
142-
/// Instantiate this module in the given imports.
142+
/// Instantiate this module with the given imports.
143143
///
144144
/// - Parameters:
145145
/// - store: The ``Store`` to allocate the instance in.

0 commit comments

Comments
 (0)