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 (function (global, utils) { | 5 (function (global, utils) { |
6 "use strict"; | 6 "use strict"; |
7 | 7 |
8 // ---------------------------------------------------------------------------- | 8 // ---------------------------------------------------------------------------- |
9 // Imports | 9 // Imports |
10 | 10 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 opt_additional_context) { | 887 opt_additional_context) { |
888 return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, | 888 return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, |
889 TO_BOOLEAN(disable_break), | 889 TO_BOOLEAN(disable_break), |
890 opt_additional_context)); | 890 opt_additional_context)); |
891 }; | 891 }; |
892 | 892 |
893 ExecutionState.prototype.frameCount = function() { | 893 ExecutionState.prototype.frameCount = function() { |
894 return %GetFrameCount(this.break_id); | 894 return %GetFrameCount(this.break_id); |
895 }; | 895 }; |
896 | 896 |
897 ExecutionState.prototype.threadCount = function() { | |
898 return %GetThreadCount(this.break_id); | |
899 }; | |
900 | |
901 ExecutionState.prototype.frame = function(opt_index) { | 897 ExecutionState.prototype.frame = function(opt_index) { |
902 // If no index supplied return the selected frame. | 898 // If no index supplied return the selected frame. |
903 if (opt_index == null) opt_index = this.selected_frame; | 899 if (opt_index == null) opt_index = this.selected_frame; |
904 if (opt_index < 0 || opt_index >= this.frameCount()) { | 900 if (opt_index < 0 || opt_index >= this.frameCount()) { |
905 throw MakeTypeError(kDebuggerFrame); | 901 throw MakeTypeError(kDebuggerFrame); |
906 } | 902 } |
907 return new FrameMirror(this.break_id, opt_index); | 903 return new FrameMirror(this.break_id, opt_index); |
908 }; | 904 }; |
909 | 905 |
910 ExecutionState.prototype.setSelectedFrame = function(index) { | 906 ExecutionState.prototype.setSelectedFrame = function(index) { |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 } | 2162 } |
2167 if (!found) continue; | 2163 if (!found) continue; |
2168 } | 2164 } |
2169 if (types & ScriptTypeFlag(scripts[i].type)) { | 2165 if (types & ScriptTypeFlag(scripts[i].type)) { |
2170 response.body.push(MakeMirror(scripts[i])); | 2166 response.body.push(MakeMirror(scripts[i])); |
2171 } | 2167 } |
2172 } | 2168 } |
2173 }; | 2169 }; |
2174 | 2170 |
2175 | 2171 |
2176 DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) { | |
2177 // Get the number of threads. | |
2178 var total_threads = this.exec_state_.threadCount(); | |
2179 | |
2180 // Get information for all threads. | |
2181 var threads = []; | |
2182 for (var i = 0; i < total_threads; i++) { | |
2183 var details = %GetThreadDetails(this.exec_state_.break_id, i); | |
2184 var thread_info = { current: details[0], | |
2185 id: details[1] | |
2186 }; | |
2187 threads.push(thread_info); | |
2188 } | |
2189 | |
2190 // Create the response body. | |
2191 response.body = { | |
2192 totalThreads: total_threads, | |
2193 threads: threads | |
2194 }; | |
2195 }; | |
2196 | |
2197 | |
2198 DebugCommandProcessor.prototype.suspendRequest_ = function(request, response) { | 2172 DebugCommandProcessor.prototype.suspendRequest_ = function(request, response) { |
2199 response.running = false; | 2173 response.running = false; |
2200 }; | 2174 }; |
2201 | 2175 |
2202 | 2176 |
2203 DebugCommandProcessor.prototype.versionRequest_ = function(request, response) { | 2177 DebugCommandProcessor.prototype.versionRequest_ = function(request, response) { |
2204 response.body = { | 2178 response.body = { |
2205 V8Version: %GetV8Version() | 2179 V8Version: %GetV8Version() |
2206 }; | 2180 }; |
2207 }; | 2181 }; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 "backtrace": proto.backtraceRequest_, | 2327 "backtrace": proto.backtraceRequest_, |
2354 "frame": proto.frameRequest_, | 2328 "frame": proto.frameRequest_, |
2355 "scopes": proto.scopesRequest_, | 2329 "scopes": proto.scopesRequest_, |
2356 "scope": proto.scopeRequest_, | 2330 "scope": proto.scopeRequest_, |
2357 "setvariablevalue": proto.setVariableValueRequest_, | 2331 "setvariablevalue": proto.setVariableValueRequest_, |
2358 "evaluate": proto.evaluateRequest_, | 2332 "evaluate": proto.evaluateRequest_, |
2359 "lookup": proto.lookupRequest_, | 2333 "lookup": proto.lookupRequest_, |
2360 "references": proto.referencesRequest_, | 2334 "references": proto.referencesRequest_, |
2361 "source": proto.sourceRequest_, | 2335 "source": proto.sourceRequest_, |
2362 "scripts": proto.scriptsRequest_, | 2336 "scripts": proto.scriptsRequest_, |
2363 "threads": proto.threadsRequest_, | |
2364 "suspend": proto.suspendRequest_, | 2337 "suspend": proto.suspendRequest_, |
2365 "version": proto.versionRequest_, | 2338 "version": proto.versionRequest_, |
2366 "changelive": proto.changeLiveRequest_, | 2339 "changelive": proto.changeLiveRequest_, |
2367 "restartframe": proto.restartFrameRequest_, | 2340 "restartframe": proto.restartFrameRequest_, |
2368 "flags": proto.debuggerFlagsRequest_, | 2341 "flags": proto.debuggerFlagsRequest_, |
2369 "v8flag": proto.v8FlagsRequest_, | 2342 "v8flag": proto.v8FlagsRequest_, |
2370 "gc": proto.gcRequest_, | 2343 "gc": proto.gcRequest_, |
2371 }; | 2344 }; |
2372 })(); | 2345 })(); |
2373 | 2346 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2487 "IsBreakPointTriggered", IsBreakPointTriggered, | 2460 "IsBreakPointTriggered", IsBreakPointTriggered, |
2488 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, | 2461 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, |
2489 ]); | 2462 ]); |
2490 | 2463 |
2491 // Export to liveedit.js | 2464 // Export to liveedit.js |
2492 utils.Export(function(to) { | 2465 utils.Export(function(to) { |
2493 to.GetScriptBreakPoints = GetScriptBreakPoints; | 2466 to.GetScriptBreakPoints = GetScriptBreakPoints; |
2494 }); | 2467 }); |
2495 | 2468 |
2496 }) | 2469 }) |
OLD | NEW |