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 | 4 |
5 // Default number of frames to include in the response to backtrace request. | 5 // Default number of frames to include in the response to backtrace request. |
6 var kDefaultBacktraceLength = 10; | 6 var kDefaultBacktraceLength = 10; |
7 | 7 |
8 var Debug = {}; | 8 var Debug = {}; |
9 | 9 |
10 // Regular expression to skip "crud" at the beginning of a source line which is | 10 // 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 | 11 // not really code. Currently the regular expression matches whitespace and |
12 // comments. | 12 // comments. |
13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; | 13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; |
14 | 14 |
15 // Debug events which can occour in the V8 JavaScript engine. These originate | 15 // Debug events which can occour in the V8 JavaScript engine. These originate |
16 // from the API include file debug.h. | 16 // from the API include file debug.h. |
17 Debug.DebugEvent = { Break: 1, | 17 Debug.DebugEvent = { Break: 1, |
18 Exception: 2, | 18 Exception: 2, |
19 NewFunction: 3, | 19 NewFunction: 3, |
20 BeforeCompile: 4, | 20 BeforeCompile: 4, |
21 AfterCompile: 5, | 21 AfterCompile: 5, |
22 ScriptCollected: 6, | 22 CompileError: 6 }; |
23 CompileError: 7 }; | |
24 | 23 |
25 // Types of exceptions that can be broken upon. | 24 // Types of exceptions that can be broken upon. |
26 Debug.ExceptionBreak = { Caught : 0, | 25 Debug.ExceptionBreak = { Caught : 0, |
27 Uncaught: 1 }; | 26 Uncaught: 1 }; |
28 | 27 |
29 // The different types of steps. | 28 // The different types of steps. |
30 Debug.StepAction = { StepOut: 0, | 29 Debug.StepAction = { StepOut: 0, |
31 StepNext: 1, | 30 StepNext: 1, |
32 StepIn: 2, | 31 StepIn: 2, |
33 StepMin: 3, | 32 StepMin: 3, |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 case Debug.DebugEvent.CompileError: | 1175 case Debug.DebugEvent.CompileError: |
1177 o.event = "compileError"; | 1176 o.event = "compileError"; |
1178 } | 1177 } |
1179 o.body = {}; | 1178 o.body = {}; |
1180 o.body.script = this.script_; | 1179 o.body.script = this.script_; |
1181 | 1180 |
1182 return o.toJSONProtocol(); | 1181 return o.toJSONProtocol(); |
1183 }; | 1182 }; |
1184 | 1183 |
1185 | 1184 |
1186 function MakeScriptCollectedEvent(id) { | |
1187 return new ScriptCollectedEvent(id); | |
1188 } | |
1189 | |
1190 | |
1191 function ScriptCollectedEvent(id) { | |
1192 this.id_ = id; | |
1193 } | |
1194 | |
1195 | |
1196 ScriptCollectedEvent.prototype.id = function() { | |
1197 return this.id_; | |
1198 }; | |
1199 | |
1200 | |
1201 ScriptCollectedEvent.prototype.toJSONProtocol = function() { | |
1202 var o = new ProtocolMessage(); | |
1203 o.running = true; | |
1204 o.event = "scriptCollected"; | |
1205 o.body = {}; | |
1206 o.body.script = { id: this.id() }; | |
1207 return o.toJSONProtocol(); | |
1208 }; | |
1209 | |
1210 | |
1211 function MakeScriptObject_(script, include_source) { | 1185 function MakeScriptObject_(script, include_source) { |
1212 var o = { id: script.id(), | 1186 var o = { id: script.id(), |
1213 name: script.name(), | 1187 name: script.name(), |
1214 lineOffset: script.lineOffset(), | 1188 lineOffset: script.lineOffset(), |
1215 columnOffset: script.columnOffset(), | 1189 columnOffset: script.columnOffset(), |
1216 lineCount: script.lineCount(), | 1190 lineCount: script.lineCount(), |
1217 }; | 1191 }; |
1218 if (!IS_UNDEFINED(script.data())) { | 1192 if (!IS_UNDEFINED(script.data())) { |
1219 o.data = script.data(); | 1193 o.data = script.data(); |
1220 } | 1194 } |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2539 | 2513 |
2540 default: | 2514 default: |
2541 json = null; | 2515 json = null; |
2542 } | 2516 } |
2543 return json; | 2517 return json; |
2544 } | 2518 } |
2545 | 2519 |
2546 Debug.TestApi = { | 2520 Debug.TestApi = { |
2547 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2521 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
2548 }; | 2522 }; |
OLD | NEW |