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: 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, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/debug-delay.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 return request.toJSONProtocol(); 493 return request.toJSONProtocol();
494 }; 494 };
495 495
496 496
497 // Create a JSON request for the backtrace command. 497 // Create a JSON request for the backtrace command.
498 DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) { 498 DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) {
499 // Build a backtrace request from the text command. 499 // Build a backtrace request from the text command.
500 var request = this.createRequest('backtrace'); 500 var request = this.createRequest('backtrace');
501
502 // Default is to show top 10 frames.
503 request.arguments = {};
504 request.arguments.fromFrame = 0;
505 request.arguments.toFrame = 10;
506
501 args = args.split(/\s*[ ]+\s*/g); 507 args = args.split(/\s*[ ]+\s*/g);
502 if (args.length == 2) { 508 if (args.length == 1 && args[0].length > 0) {
503 request.arguments = {}; 509 var frameCount = parseInt(args[0]);
510 if (frameCount > 0) {
511 // Show top frames.
512 request.arguments.fromFrame = 0;
513 request.arguments.toFrame = frameCount;
514 } else {
515 // Show bottom frames.
516 request.arguments.fromFrame = 0;
517 request.arguments.toFrame = -frameCount;
518 request.arguments.bottom = true;
519 }
520 } else if (args.length == 2) {
504 var fromFrame = parseInt(args[0]); 521 var fromFrame = parseInt(args[0]);
505 var toFrame = parseInt(args[1]); 522 var toFrame = parseInt(args[1]);
506 if (isNaN(fromFrame) || fromFrame < 0) { 523 if (isNaN(fromFrame) || fromFrame < 0) {
507 throw new Error('Invalid start frame argument "' + args[0] + '".'); 524 throw new Error('Invalid start frame argument "' + args[0] + '".');
508 } 525 }
509 if (isNaN(toFrame) || toFrame < 0) { 526 if (isNaN(toFrame) || toFrame < 0) {
510 throw new Error('Invalid end frame argument "' + args[1] + '".'); 527 throw new Error('Invalid end frame argument "' + args[1] + '".');
511 } 528 }
512 if (fromFrame > toFrame) { 529 if (fromFrame > toFrame) {
513 throw new Error('Invalid arguments start frame cannot be larger ' + 530 throw new Error('Invalid arguments start frame cannot be larger ' +
514 'than end frame.'); 531 'than end frame.');
515 } 532 }
533 // Show frame range.
516 request.arguments.fromFrame = fromFrame; 534 request.arguments.fromFrame = fromFrame;
517 request.arguments.toFrame = toFrame + 1; 535 request.arguments.toFrame = toFrame + 1;
536 } else if (args.length > 2) {
537 throw new Error('Invalid backtrace arguments.');
518 } 538 }
539
519 return request.toJSONProtocol(); 540 return request.toJSONProtocol();
520 }; 541 };
521 542
522 543
523 // Create a JSON request for the frame command. 544 // Create a JSON request for the frame command.
524 DebugRequest.prototype.frameCommandToJSONRequest_ = function(args) { 545 DebugRequest.prototype.frameCommandToJSONRequest_ = function(args) {
525 // Build a frame request from the text command. 546 // Build a frame request from the text command.
526 var request = this.createRequest('frame'); 547 var request = this.createRequest('frame');
527 args = args.split(/\s*[ ]+\s*/g); 548 args = args.split(/\s*[ ]+\s*/g);
528 if (args.length > 0 && args[0].length > 0) { 549 if (args.length > 0 && args[0].length > 0) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 // Help os quite simple. 769 // Help os quite simple.
749 if (args && args.length > 0) { 770 if (args && args.length > 0) {
750 print('warning: arguments to \'help\' are ignored'); 771 print('warning: arguments to \'help\' are ignored');
751 } 772 }
752 773
753 print('break location [condition]'); 774 print('break location [condition]');
754 print(' break on named function: location is a function name'); 775 print(' break on named function: location is a function name');
755 print(' break on function: location is #<id>#'); 776 print(' break on function: location is #<id>#');
756 print(' break on script position: location is name:line[:column]'); 777 print(' break on script position: location is name:line[:column]');
757 print('clear <breakpoint #>'); 778 print('clear <breakpoint #>');
758 print('backtrace [from frame #] [to frame #]]'); 779 print('backtrace [n] | [-n] | [from to]');
759 print('frame <frame #>'); 780 print('frame <frame #>');
760 print('step [in | next | out| min [step count]]'); 781 print('step [in | next | out| min [step count]]');
761 print('print <expression>'); 782 print('print <expression>');
762 print('source [from line [num lines]]'); 783 print('source [from line [num lines]]');
763 print('scripts'); 784 print('scripts');
764 print('continue'); 785 print('continue');
765 print('trace compile'); 786 print('trace compile');
766 print('help'); 787 print('help');
767 } 788 }
768 789
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 json += NumberToJSON_(elem); 1479 json += NumberToJSON_(elem);
1459 } else if (typeof(elem) === 'string') { 1480 } else if (typeof(elem) === 'string') {
1460 json += StringToJSON_(elem); 1481 json += StringToJSON_(elem);
1461 } else { 1482 } else {
1462 json += elem; 1483 json += elem;
1463 } 1484 }
1464 } 1485 }
1465 json += ']'; 1486 json += ']';
1466 return json; 1487 return json;
1467 } 1488 }
OLDNEW
« 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