OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "use strict"; |
4 | 5 |
5 // Default number of frames to include in the response to backtrace request. | 6 // Default number of frames to include in the response to backtrace request. |
6 var kDefaultBacktraceLength = 10; | 7 var kDefaultBacktraceLength = 10; |
7 | 8 |
8 var Debug = {}; | 9 var Debug = {}; |
9 | 10 |
10 // Regular expression to skip "crud" at the beginning of a source line which is | 11 // Regular expression to skip "crud" at the beginning of a source line which is |
11 // not really code. Currently the regular expression matches whitespace and | 12 // not really code. Currently the regular expression matches whitespace and |
12 // comments. | 13 // comments. |
13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; | 14 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 break_point.setCondition(opt_condition); | 666 break_point.setCondition(opt_condition); |
666 return break_point.number(); | 667 return break_point.number(); |
667 } | 668 } |
668 }; | 669 }; |
669 | 670 |
670 | 671 |
671 Debug.setBreakPointByScriptIdAndPosition = function(script_id, position, | 672 Debug.setBreakPointByScriptIdAndPosition = function(script_id, position, |
672 condition, enabled, | 673 condition, enabled, |
673 opt_position_alignment) | 674 opt_position_alignment) |
674 { | 675 { |
675 break_point = MakeBreakPoint(position); | 676 var break_point = MakeBreakPoint(position); |
676 break_point.setCondition(condition); | 677 break_point.setCondition(condition); |
677 if (!enabled) { | 678 if (!enabled) { |
678 break_point.disable(); | 679 break_point.disable(); |
679 } | 680 } |
680 var scripts = this.scripts(); | 681 var scripts = this.scripts(); |
681 var position_alignment = IS_UNDEFINED(opt_position_alignment) | 682 var position_alignment = IS_UNDEFINED(opt_position_alignment) |
682 ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; | 683 ? Debug.BreakPositionAlignment.Statement : opt_position_alignment; |
683 for (var i = 0; i < scripts.length; i++) { | 684 for (var i = 0; i < scripts.length; i++) { |
684 if (script_id == scripts[i].id) { | 685 if (script_id == scripts[i].id) { |
685 break_point.actual_position = %SetScriptBreakPoint(scripts[i], position, | 686 break_point.actual_position = %SetScriptBreakPoint(scripts[i], position, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 break_point = this.findScriptBreakPoint(break_point_number, true); | 733 break_point = this.findScriptBreakPoint(break_point_number, true); |
733 if (!break_point) { | 734 if (!break_point) { |
734 throw new Error('Invalid breakpoint'); | 735 throw new Error('Invalid breakpoint'); |
735 } | 736 } |
736 } | 737 } |
737 }; | 738 }; |
738 | 739 |
739 | 740 |
740 Debug.clearAllBreakPoints = function() { | 741 Debug.clearAllBreakPoints = function() { |
741 for (var i = 0; i < break_points.length; i++) { | 742 for (var i = 0; i < break_points.length; i++) { |
742 break_point = break_points[i]; | 743 var break_point = break_points[i]; |
743 %ClearBreakPoint(break_point); | 744 %ClearBreakPoint(break_point); |
744 } | 745 } |
745 break_points = []; | 746 break_points = []; |
746 }; | 747 }; |
747 | 748 |
748 | 749 |
749 Debug.disableAllBreakPoints = function() { | 750 Debug.disableAllBreakPoints = function() { |
750 // Disable all user defined breakpoints: | 751 // Disable all user defined breakpoints: |
751 for (var i = 1; i < next_break_point_number; i++) { | 752 for (var i = 1; i < next_break_point_number; i++) { |
752 Debug.disableBreakPoint(i); | 753 Debug.disableBreakPoint(i); |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 | 2581 |
2581 default: | 2582 default: |
2582 json = null; | 2583 json = null; |
2583 } | 2584 } |
2584 return json; | 2585 return json; |
2585 } | 2586 } |
2586 | 2587 |
2587 Debug.TestApi = { | 2588 Debug.TestApi = { |
2588 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2589 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
2589 }; | 2590 }; |
OLD | NEW |