Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: test/inspector/debugger/wasm-get-breakable-locations.js

Issue 2728563002: [inspector] added type of break location into getPossibleBreakpoints output (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load('test/mjsunit/wasm/wasm-constants.js'); 7 load('test/mjsunit/wasm/wasm-constants.js');
8 load('test/mjsunit/wasm/wasm-module-builder.js'); 8 load('test/mjsunit/wasm/wasm-module-builder.js');
9 9
10 var builder = new WasmModuleBuilder(); 10 var builder = new WasmModuleBuilder();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 function printFailure(message) { 83 function printFailure(message) {
84 if (!message.result) { 84 if (!message.result) {
85 InspectorTest.logMessage(message); 85 InspectorTest.logMessage(message);
86 } 86 }
87 return message; 87 return message;
88 } 88 }
89 89
90 function printBreakableLocations(message, expectedScriptId, source) { 90 function printBreakableLocations(message, expectedScriptId, source) {
91 var lines = source.split('\n'); 91 var lines = source.split('\n');
92 var locations = message.result.locations; 92 var locations = message.result.locations.map(location => location.location);
93 InspectorTest.log(locations.length + ' breakable location(s):'); 93 InspectorTest.log(locations.length + ' breakable location(s):');
94 for (var i = 0; i < locations.length; ++i) { 94 for (var i = 0; i < locations.length; ++i) {
95 if (locations[i].scriptId != expectedScriptId) { 95 if (locations[i].scriptId != expectedScriptId) {
96 InspectorTest.log( 96 InspectorTest.log(
97 'SCRIPT ID MISMATCH!! ' + locations[i].scriptId + ' != ' + 97 'SCRIPT ID MISMATCH!! ' + locations[i].scriptId + ' != ' +
98 expectedScriptId); 98 expectedScriptId);
99 } 99 }
100 var line = '<illegal line number>'; 100 var line = '<illegal line number>';
101 if (locations[i].lineNumber < lines.length) { 101 if (locations[i].lineNumber < lines.length) {
102 line = lines[locations[i].lineNumber]; 102 line = lines[locations[i].lineNumber];
(...skipping 12 matching lines...) Expand all
115 InspectorTest.log( 115 InspectorTest.log(
116 'Requesting all breakable locations in wasm script ' + wasmScriptNr); 116 'Requesting all breakable locations in wasm script ' + wasmScriptNr);
117 var scriptId = wasmScripts[wasmScriptNr]; 117 var scriptId = wasmScripts[wasmScriptNr];
118 var source; 118 var source;
119 return Protocol.Debugger.getScriptSource({scriptId: scriptId}) 119 return Protocol.Debugger.getScriptSource({scriptId: scriptId})
120 .then(msg => source = msg.result.scriptSource) 120 .then(msg => source = msg.result.scriptSource)
121 .then( 121 .then(
122 () => Protocol.Debugger.getPossibleBreakpoints( 122 () => Protocol.Debugger.getPossibleBreakpoints(
123 {start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}})) 123 {start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}}))
124 .then(printFailure) 124 .then(printFailure)
125 .then(msg => (allBreakableLocations.push(...msg.result.locations), msg)) 125 .then(msg => (allBreakableLocations.push(...msg.result.locations.map(l => l.location)), msg))
126 .then(msg => printBreakableLocations(msg, scriptId, source)) 126 .then(msg => printBreakableLocations(msg, scriptId, source))
127 .then( 127 .then(
128 () => InspectorTest.log( 128 () => InspectorTest.log(
129 'Requesting breakable locations in lines [0,3)')) 129 'Requesting breakable locations in lines [0,3)'))
130 .then(() => Protocol.Debugger.getPossibleBreakpoints({ 130 .then(() => Protocol.Debugger.getPossibleBreakpoints({
131 start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}, 131 start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId},
132 end: {lineNumber: 3, columnNumber: 0, scriptId: scriptId} 132 end: {lineNumber: 3, columnNumber: 0, scriptId: scriptId}
133 })) 133 }))
134 .then(printFailure) 134 .then(printFailure)
135 .then(msg => printBreakableLocations(msg, scriptId, source)) 135 .then(msg => printBreakableLocations(msg, scriptId, source))
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 function waitForAllPauses() { 201 function waitForAllPauses() {
202 InspectorTest.log('Missing breakpoints: ' + allBreakableLocations.length); 202 InspectorTest.log('Missing breakpoints: ' + allBreakableLocations.length);
203 if (allBreakableLocations.length == 0) return; 203 if (allBreakableLocations.length == 0) return;
204 return Protocol.Debugger.oncePaused() 204 return Protocol.Debugger.oncePaused()
205 .then(removePausedLocation) 205 .then(removePausedLocation)
206 .then(Protocol.Debugger.resume()) 206 .then(Protocol.Debugger.resume())
207 .then(waitForAllPauses); 207 .then(waitForAllPauses);
208 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698