(location, forceSourceRequest)
| 304 | } |
| 305 | |
| 306 | async logSourceLocation(location, forceSourceRequest) { |
| 307 | var scriptId = location.scriptId; |
| 308 | if (!this._scriptMap || !this._scriptMap.has(scriptId)) { |
| 309 | InspectorTest.log("setupScriptMap should be called before Protocol.Debugger.enable."); |
| 310 | InspectorTest.completeTest(); |
| 311 | } |
| 312 | var script = await this.getScriptWithSource(scriptId, forceSourceRequest); |
| 313 | |
| 314 | if (script.bytecode) { |
| 315 | if (location.lineNumber != 0) { |
| 316 | InspectorTest.log('Unexpected wasm line number: ' + location.lineNumber); |
| 317 | } |
| 318 | let wasm_opcode = script.bytecode[location.columnNumber]; |
| 319 | let opcode_str = wasm_opcode.toString(16); |
| 320 | if (opcode_str.length % 2) opcode_str = `0${opcode_str}`; |
| 321 | if (InspectorTest.getWasmOpcodeName) { |
| 322 | opcode_str += ` (${InspectorTest.getWasmOpcodeName(wasm_opcode)})`; |
| 323 | } |
| 324 | InspectorTest.log(`Script ${script.url} byte offset ${ |
| 325 | location.columnNumber}: Wasm opcode 0x${opcode_str}`); |
| 326 | } else { |
| 327 | var lines = script.scriptSource.split('\n'); |
| 328 | var line = lines[location.lineNumber]; |
| 329 | line = line.slice(0, location.columnNumber) + '#' + (line.slice(location.columnNumber) || ''); |
| 330 | lines[location.lineNumber] = line; |
| 331 | lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1); |
| 332 | InspectorTest.log(lines.slice(Math.max(location.lineNumber - 1, 0), location.lineNumber + 2).join('\n')); |
| 333 | InspectorTest.log(''); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | logSourceLocations(locations) { |
| 338 | if (locations.length == 0) return Promise.resolve(); |
no test coverage detected