OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 this.nextMessageId = 0; | 25 this.nextMessageId = 0; |
26 | 26 |
27 // The listener method called on certain events. | 27 // The listener method called on certain events. |
28 this.listener = undefined; | 28 this.listener = undefined; |
29 | 29 |
30 // Debug events which can occur in the V8 JavaScript engine. | 30 // Debug events which can occur in the V8 JavaScript engine. |
31 this.DebugEvent = { Break: 1, | 31 this.DebugEvent = { Break: 1, |
32 Exception: 2, | 32 Exception: 2, |
33 AfterCompile: 3, | 33 AfterCompile: 3, |
34 CompileError: 4, | 34 CompileError: 4, |
| 35 OOM: 5, |
35 }; | 36 }; |
36 | 37 |
37 // The different types of steps. | 38 // The different types of steps. |
38 this.StepAction = { StepOut: 0, | 39 this.StepAction = { StepOut: 0, |
39 StepNext: 1, | 40 StepNext: 1, |
40 StepIn: 2, | 41 StepIn: 2, |
41 }; | 42 }; |
42 | 43 |
43 // The different types of scripts matching enum ScriptType in objects.h. | 44 // The different types of scripts matching enum ScriptType in objects.h. |
44 this.ScriptType = { Native: 0, | 45 this.ScriptType = { Native: 0, |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 812 |
812 handleDebuggerPaused(message) { | 813 handleDebuggerPaused(message) { |
813 const params = message.params; | 814 const params = message.params; |
814 | 815 |
815 var debugEvent; | 816 var debugEvent; |
816 switch (params.reason) { | 817 switch (params.reason) { |
817 case "exception": | 818 case "exception": |
818 case "promiseRejection": | 819 case "promiseRejection": |
819 debugEvent = this.DebugEvent.Exception; | 820 debugEvent = this.DebugEvent.Exception; |
820 break; | 821 break; |
821 default: | 822 case "OOM": |
822 // TODO(jgruber): More granularity. | 823 debugEvent = this.DebugEvent.OOM; |
| 824 break; |
| 825 case "other": |
823 debugEvent = this.DebugEvent.Break; | 826 debugEvent = this.DebugEvent.Break; |
824 break; | 827 break; |
| 828 case "ambiguous": |
| 829 case "XHR": |
| 830 case "DOM": |
| 831 case "EventListener": |
| 832 case "assert": |
| 833 case "debugCommand": |
| 834 assertUnreachable(); |
| 835 default: |
| 836 assertUnreachable(); |
825 } | 837 } |
826 | 838 |
827 if (!params.callFrames[0]) return; | 839 if (!params.callFrames[0]) return; |
828 | 840 |
829 // Skip break events in this file. | 841 // Skip break events in this file. |
830 if (params.callFrames[0].location.scriptId == this.thisScriptId) return; | 842 if (params.callFrames[0].location.scriptId == this.thisScriptId) return; |
831 | 843 |
832 // TODO(jgruber): Arguments as needed. | 844 // TODO(jgruber): Arguments as needed. |
833 let execState = { frames : params.callFrames, | 845 let execState = { frames : params.callFrames, |
834 prepareStep : this.execStatePrepareStep.bind(this), | 846 prepareStep : this.execStatePrepareStep.bind(this), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 debug.instance = new DebugWrapper(); | 902 debug.instance = new DebugWrapper(); |
891 debug.instance.enable(); | 903 debug.instance.enable(); |
892 } | 904 } |
893 return debug.instance; | 905 return debug.instance; |
894 }}); | 906 }}); |
895 | 907 |
896 Object.defineProperty(debug, 'ScopeType', { get: function() { | 908 Object.defineProperty(debug, 'ScopeType', { get: function() { |
897 const instance = debug.Debug; | 909 const instance = debug.Debug; |
898 return instance.ScopeType; | 910 return instance.ScopeType; |
899 }}); | 911 }}); |
OLD | NEW |