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

Side by Side Diff: test/debugger/test-api.js

Issue 2516343003: [debug-wrapper] migrate debug-backtrace from DCP. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « test/debugger/debug/debug-backtrace.js ('k') | test/mjsunit/debug-backtrace.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "use strict"; 5 "use strict";
6 6
7 // If true, prints all messages sent and received by inspector. 7 // If true, prints all messages sent and received by inspector.
8 const printProtocolMessages = false; 8 const printProtocolMessages = false;
9 9
10 // The active wrapper instance. 10 // The active wrapper instance.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const id = this.getNextMessageId(); 307 const id = this.getNextMessageId();
308 const msg = JSON.stringify({ 308 const msg = JSON.stringify({
309 id: id, 309 id: id,
310 method: method, 310 method: method,
311 params: params, 311 params: params,
312 }); 312 });
313 return { msgid : id, msg: msg }; 313 return { msgid : id, msg: msg };
314 } 314 }
315 315
316 receiveMessage(message) { 316 receiveMessage(message) {
317 if (printProtocolMessages) print(message);
318
319 const parsedMessage = JSON.parse(message); 317 const parsedMessage = JSON.parse(message);
318 if (printProtocolMessages) {
319 print(JSON.stringify(parsedMessage, undefined, 1));
320 }
320 if (parsedMessage.id !== undefined) { 321 if (parsedMessage.id !== undefined) {
321 this.receivedMessages.set(parsedMessage.id, parsedMessage); 322 this.receivedMessages.set(parsedMessage.id, parsedMessage);
322 } 323 }
323 324
324 this.dispatchMessage(parsedMessage); 325 this.dispatchMessage(parsedMessage);
325 } 326 }
326 327
327 sendMessage(message) { 328 sendMessage(message) {
328 if (printProtocolMessages) print(message); 329 if (printProtocolMessages) print(message);
329 send(message); 330 send(message);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 this.sendMessage(msg); 601 this.sendMessage(msg);
601 this.takeReplyChecked(msgid); 602 this.takeReplyChecked(msgid);
602 } 603 }
603 604
604 execStateFrame(frame) { 605 execStateFrame(frame) {
605 const scriptid = parseInt(frame.location.scriptId); 606 const scriptid = parseInt(frame.location.scriptId);
606 const line = frame.location.lineNumber; 607 const line = frame.location.lineNumber;
607 const column = frame.location.columnNumber; 608 const column = frame.location.columnNumber;
608 const loc = %ScriptLocationFromLine2(scriptid, line, column, 0); 609 const loc = %ScriptLocationFromLine2(scriptid, line, column, 0);
609 const func = { name : () => frame.functionName }; 610 const func = { name : () => frame.functionName };
611 const index = JSON.parse(frame.callFrameId).ordinal;
610 612
611 function allScopes() { 613 function allScopes() {
612 const scopes = []; 614 const scopes = [];
613 for (let i = 0; i < frame.scopeChain.length; i++) { 615 for (let i = 0; i < frame.scopeChain.length; i++) {
614 scopes.push(this.execStateScope(frame, i)); 616 scopes.push(this.execStateScope(frame, i));
615 } 617 }
616 return scopes; 618 return scopes;
617 }; 619 };
618 620
619 return { sourceColumn : () => loc.column, 621 return { sourceColumn : () => loc.column,
620 sourceLine : () => loc.line + 1, 622 sourceLine : () => loc.line + 1,
621 sourceLineText : () => loc.sourceText, 623 sourceLineText : () => loc.sourceText,
622 evaluate : (expr) => this.evaluateOnCallFrame(frame, expr), 624 evaluate : (expr) => this.evaluateOnCallFrame(frame, expr),
623 functionName : () => frame.functionName, 625 functionName : () => frame.functionName,
624 func : () => func, 626 func : () => func,
627 index : () => index,
625 localCount : () => this.execStateFrameLocalCount(frame), 628 localCount : () => this.execStateFrameLocalCount(frame),
626 localName : (ix) => this.execStateFrameLocalName(frame, ix), 629 localName : (ix) => this.execStateFrameLocalName(frame, ix),
627 localValue: (ix) => this.execStateFrameLocalValue(frame, ix), 630 localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
628 receiver : () => this.evaluateOnCallFrame(frame, "this"), 631 receiver : () => this.evaluateOnCallFrame(frame, "this"),
629 restart : () => this.execStateFrameRestart(frame), 632 restart : () => this.execStateFrameRestart(frame),
630 scopeCount : () => frame.scopeChain.length, 633 scopeCount : () => frame.scopeChain.length,
631 scope : (index) => this.execStateScope(frame, index), 634 scope : (index) => this.execStateScope(frame, index),
632 allScopes : allScopes.bind(this) 635 allScopes : allScopes.bind(this)
633 }; 636 };
634 } 637 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 debug.instance = new DebugWrapper(); 767 debug.instance = new DebugWrapper();
765 debug.instance.enable(); 768 debug.instance.enable();
766 } 769 }
767 return debug.instance; 770 return debug.instance;
768 }}); 771 }});
769 772
770 Object.defineProperty(debug, 'ScopeType', { get: function() { 773 Object.defineProperty(debug, 'ScopeType', { get: function() {
771 const instance = debug.Debug; 774 const instance = debug.Debug;
772 return instance.ScopeType; 775 return instance.ScopeType;
773 }}); 776 }});
OLDNEW
« no previous file with comments | « test/debugger/debug/debug-backtrace.js ('k') | test/mjsunit/debug-backtrace.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698