| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 27 matching lines...) Expand all Loading... |
| 38 // Debug events which can occour in the V8 JavaScript engine. These originate | 38 // Debug events which can occour in the V8 JavaScript engine. These originate |
| 39 // from the API include file debug.h. | 39 // from the API include file debug.h. |
| 40 Debug.DebugEvent = { Break: 1, | 40 Debug.DebugEvent = { Break: 1, |
| 41 Exception: 2, | 41 Exception: 2, |
| 42 NewFunction: 3, | 42 NewFunction: 3, |
| 43 BeforeCompile: 4, | 43 BeforeCompile: 4, |
| 44 AfterCompile: 5, | 44 AfterCompile: 5, |
| 45 ScriptCollected: 6 }; | 45 ScriptCollected: 6 }; |
| 46 | 46 |
| 47 // Types of exceptions that can be broken upon. | 47 // Types of exceptions that can be broken upon. |
| 48 Debug.ExceptionBreak = { All : 0, | 48 Debug.ExceptionBreak = { Caught : 0, |
| 49 Uncaught: 1 }; | 49 Uncaught: 1 }; |
| 50 | 50 |
| 51 // The different types of steps. | 51 // The different types of steps. |
| 52 Debug.StepAction = { StepOut: 0, | 52 Debug.StepAction = { StepOut: 0, |
| 53 StepNext: 1, | 53 StepNext: 1, |
| 54 StepIn: 2, | 54 StepIn: 2, |
| 55 StepMin: 3, | 55 StepMin: 3, |
| 56 StepInMin: 4 }; | 56 StepInMin: 4 }; |
| 57 | 57 |
| 58 // The different types of scripts matching enum ScriptType in objects.h. | 58 // The different types of scripts matching enum ScriptType in objects.h. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 80 var break_points = []; | 80 var break_points = []; |
| 81 var script_break_points = []; | 81 var script_break_points = []; |
| 82 var debugger_flags = { | 82 var debugger_flags = { |
| 83 breakPointsActive: { | 83 breakPointsActive: { |
| 84 value: true, | 84 value: true, |
| 85 getValue: function() { return this.value; }, | 85 getValue: function() { return this.value; }, |
| 86 setValue: function(value) { | 86 setValue: function(value) { |
| 87 this.value = !!value; | 87 this.value = !!value; |
| 88 %SetDisableBreak(!this.value); | 88 %SetDisableBreak(!this.value); |
| 89 } | 89 } |
| 90 } | 90 }, |
| 91 breakOnCaughtException: { |
| 92 getValue: function() { return Debug.isBreakOnException(); }, |
| 93 setValue: function(value) { |
| 94 if (value) { |
| 95 Debug.setBreakOnException(); |
| 96 } else { |
| 97 Debug.clearBreakOnException(); |
| 98 } |
| 99 } |
| 100 }, |
| 101 breakOnUncaughtException: { |
| 102 getValue: function() { return Debug.isBreakOnUncaughtException(); }, |
| 103 setValue: function(value) { |
| 104 if (value) { |
| 105 Debug.setBreakOnUncaughtException(); |
| 106 } else { |
| 107 Debug.clearBreakOnUncaughtException(); |
| 108 } |
| 109 } |
| 110 }, |
| 91 }; | 111 }; |
| 92 | 112 |
| 93 | 113 |
| 94 // Create a new break point object and add it to the list of break points. | 114 // Create a new break point object and add it to the list of break points. |
| 95 function MakeBreakPoint(source_position, opt_line, opt_column, opt_script_break_
point) { | 115 function MakeBreakPoint(source_position, opt_line, opt_column, opt_script_break_
point) { |
| 96 var break_point = new BreakPoint(source_position, opt_line, opt_column, opt_sc
ript_break_point); | 116 var break_point = new BreakPoint(source_position, opt_line, opt_column, opt_sc
ript_break_point); |
| 97 break_points.push(break_point); | 117 break_points.push(break_point); |
| 98 return break_point; | 118 return break_point; |
| 99 } | 119 } |
| 100 | 120 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 Debug.scriptBreakPoints = function() { | 794 Debug.scriptBreakPoints = function() { |
| 775 return script_break_points; | 795 return script_break_points; |
| 776 } | 796 } |
| 777 | 797 |
| 778 | 798 |
| 779 Debug.clearStepping = function() { | 799 Debug.clearStepping = function() { |
| 780 %ClearStepping(); | 800 %ClearStepping(); |
| 781 } | 801 } |
| 782 | 802 |
| 783 Debug.setBreakOnException = function() { | 803 Debug.setBreakOnException = function() { |
| 784 return %ChangeBreakOnException(Debug.ExceptionBreak.All, true); | 804 return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, true); |
| 785 }; | 805 }; |
| 786 | 806 |
| 787 Debug.clearBreakOnException = function() { | 807 Debug.clearBreakOnException = function() { |
| 788 return %ChangeBreakOnException(Debug.ExceptionBreak.All, false); | 808 return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, false); |
| 809 }; |
| 810 |
| 811 Debug.isBreakOnException = function() { |
| 812 return !!%IsBreakOnException(Debug.ExceptionBreak.Caught); |
| 789 }; | 813 }; |
| 790 | 814 |
| 791 Debug.setBreakOnUncaughtException = function() { | 815 Debug.setBreakOnUncaughtException = function() { |
| 792 return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, true); | 816 return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, true); |
| 793 }; | 817 }; |
| 794 | 818 |
| 795 Debug.clearBreakOnUncaughtException = function() { | 819 Debug.clearBreakOnUncaughtException = function() { |
| 796 return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, false); | 820 return %ChangeBreakOnException(Debug.ExceptionBreak.Uncaught, false); |
| 797 }; | 821 }; |
| 798 | 822 |
| 823 Debug.isBreakOnUncaughtException = function() { |
| 824 return !!%IsBreakOnException(Debug.ExceptionBreak.Uncaught); |
| 825 }; |
| 826 |
| 799 Debug.showBreakPoints = function(f, full) { | 827 Debug.showBreakPoints = function(f, full) { |
| 800 if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); | 828 if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.'); |
| 801 var source = full ? this.scriptSource(f) : this.source(f); | 829 var source = full ? this.scriptSource(f) : this.source(f); |
| 802 var offset = full ? this.sourcePosition(f) : 0; | 830 var offset = full ? this.sourcePosition(f) : 0; |
| 803 var locations = this.breakLocations(f); | 831 var locations = this.breakLocations(f); |
| 804 if (!locations) return source; | 832 if (!locations) return source; |
| 805 locations.sort(function(x, y) { return x - y; }); | 833 locations.sort(function(x, y) { return x - y; }); |
| 806 var result = ""; | 834 var result = ""; |
| 807 var prev_pos = 0; | 835 var prev_pos = 0; |
| 808 var pos; | 836 var pos; |
| (...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2274 case 'string': | 2302 case 'string': |
| 2275 case 'number': | 2303 case 'number': |
| 2276 json = value; | 2304 json = value; |
| 2277 break | 2305 break |
| 2278 | 2306 |
| 2279 default: | 2307 default: |
| 2280 json = null; | 2308 json = null; |
| 2281 } | 2309 } |
| 2282 return json; | 2310 return json; |
| 2283 } | 2311 } |
| OLD | NEW |