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

Unified Diff: src/d8.js

Issue 99342: Added support to backtrace from botton of stack to debugger protocol (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/debug-delay.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.js
===================================================================
--- src/d8.js (revision 1840)
+++ src/d8.js (working copy)
@@ -498,9 +498,26 @@
DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) {
// Build a backtrace request from the text command.
var request = this.createRequest('backtrace');
+
+ // Default is to show top 10 frames.
+ request.arguments = {};
+ request.arguments.fromFrame = 0;
+ request.arguments.toFrame = 10;
+
args = args.split(/\s*[ ]+\s*/g);
- if (args.length == 2) {
- request.arguments = {};
+ if (args.length == 1 && args[0].length > 0) {
+ var frameCount = parseInt(args[0]);
+ if (frameCount > 0) {
+ // Show top frames.
+ request.arguments.fromFrame = 0;
+ request.arguments.toFrame = frameCount;
+ } else {
+ // Show bottom frames.
+ request.arguments.fromFrame = 0;
+ request.arguments.toFrame = -frameCount;
+ request.arguments.bottom = true;
+ }
+ } else if (args.length == 2) {
var fromFrame = parseInt(args[0]);
var toFrame = parseInt(args[1]);
if (isNaN(fromFrame) || fromFrame < 0) {
@@ -513,9 +530,13 @@
throw new Error('Invalid arguments start frame cannot be larger ' +
'than end frame.');
}
+ // Show frame range.
request.arguments.fromFrame = fromFrame;
request.arguments.toFrame = toFrame + 1;
+ } else if (args.length > 2) {
+ throw new Error('Invalid backtrace arguments.');
}
+
return request.toJSONProtocol();
};
@@ -755,7 +776,7 @@
print(' break on function: location is #<id>#');
print(' break on script position: location is name:line[:column]');
print('clear <breakpoint #>');
- print('backtrace [from frame #] [to frame #]]');
+ print('backtrace [n] | [-n] | [from to]');
print('frame <frame #>');
print('step [in | next | out| min [step count]]');
print('print <expression>');
« no previous file with comments | « no previous file | src/debug-delay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698