|
56 | 56 | private let allocator: ByteBufferAllocator |
57 | 57 | private var debugger: Debugger |
58 | 58 |
|
59 | | - private var memoryCache: DebuggerMemoryCache |
| 59 | + private var memoryView: DebuggerMemoryView |
60 | 60 |
|
61 | 61 | package init( |
62 | 62 | moduleFilePath: FilePath, |
|
85 | 85 | throw Error.stoppingAtEntrypointFailed |
86 | 86 | } |
87 | 87 |
|
88 | | - self.memoryCache = DebuggerMemoryCache(allocator: allocator, wasmBinary: wasmBinary) |
| 88 | + self.memoryView = DebuggerMemoryView(allocator: allocator, wasmBinary: wasmBinary) |
89 | 89 | } |
90 | 90 |
|
91 | 91 | private func hexDump<I: FixedWidthInteger>(_ value: I, endianness: Endianness) -> String { |
|
117 | 117 | switch self.debugger.state { |
118 | 118 | case .stoppedAtBreakpoint(let breakpoint): |
119 | 119 | let pc = breakpoint.wasmPc |
120 | | - let pcInHostAddressSpace = UInt64(pc) + DebuggerMemoryCache.executableCodeOffset |
| 120 | + let pcInHostAddressSpace = UInt64(pc) + DebuggerMemoryView.executableCodeOffset |
121 | 121 | result.append(("thread-pcs", self.hexDump(pcInHostAddressSpace, endianness: .big))) |
122 | 122 | result.append(("00", self.hexDump(pcInHostAddressSpace, endianness: .little))) |
123 | 123 | result.append(("reason", "trace")) |
|
221 | 221 | """ |
222 | 222 | l<library-list>\ |
223 | 223 | <library name="\(self.moduleFilePath.string)">\ |
224 | | - <section address="0x\(String(DebuggerMemoryCache.executableCodeOffset, radix: 16))"/>\ |
| 224 | + <section address="0x\(String(DebuggerMemoryView.executableCodeOffset, radix: 16))"/>\ |
225 | 225 | </library>\ |
226 | 226 | </library-list> |
227 | 227 | """) |
|
238 | 238 | else { throw Error.unknownReadMemoryArguments } |
239 | 239 |
|
240 | 240 | responseKind = .hexEncodedBinary( |
241 | | - try self.memoryCache.readMemory( |
| 241 | + try self.memoryView.readMemory( |
242 | 242 | debugger: self.debugger, |
243 | 243 | addressInProtocolSpace: addressInProtocolSpace, |
244 | 244 | length: length |
|
249 | 249 | let callStack = self.debugger.currentCallStack |
250 | 250 | var buffer = self.allocator.buffer(capacity: callStack.count * 8) |
251 | 251 | for pc in callStack { |
252 | | - buffer.writeInteger(UInt64(pc) + DebuggerMemoryCache.executableCodeOffset, endianness: .little) |
| 252 | + buffer.writeInteger(UInt64(pc) + DebuggerMemoryView.executableCodeOffset, endianness: .little) |
253 | 253 | } |
254 | 254 | responseKind = .hexEncodedBinary(buffer.readableBytesView) |
255 | 255 |
|
|
288 | 288 | argumentsString: command.arguments, |
289 | 289 | separator: ",", |
290 | 290 | endianness: .big |
291 | | - ) - DebuggerMemoryCache.executableCodeOffset) |
| 291 | + ) - DebuggerMemoryView.executableCodeOffset) |
292 | 292 | ) |
293 | 293 | responseKind = .ok |
294 | 294 |
|
|
299 | 299 | argumentsString: command.arguments, |
300 | 300 | separator: ",", |
301 | 301 | endianness: .big |
302 | | - ) - DebuggerMemoryCache.executableCodeOffset) |
| 302 | + ) - DebuggerMemoryView.executableCodeOffset) |
303 | 303 | ) |
304 | 304 | responseKind = .ok |
305 | 305 |
|
|
0 commit comments