OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1442 } else if (request.command == 'threads') { | 1442 } else if (request.command == 'threads') { |
1443 this.threadsRequest_(request, response); | 1443 this.threadsRequest_(request, response); |
1444 } else if (request.command == 'suspend') { | 1444 } else if (request.command == 'suspend') { |
1445 this.suspendRequest_(request, response); | 1445 this.suspendRequest_(request, response); |
1446 } else if (request.command == 'version') { | 1446 } else if (request.command == 'version') { |
1447 this.versionRequest_(request, response); | 1447 this.versionRequest_(request, response); |
1448 } else if (request.command == 'profile') { | 1448 } else if (request.command == 'profile') { |
1449 this.profileRequest_(request, response); | 1449 this.profileRequest_(request, response); |
1450 } else if (request.command == 'changelive') { | 1450 } else if (request.command == 'changelive') { |
1451 this.changeLiveRequest_(request, response); | 1451 this.changeLiveRequest_(request, response); |
1452 } else if (request.command == 'restartframe') { | |
1453 this.restartFrameRequest_(request, response); | |
1452 } else if (request.command == 'flags') { | 1454 } else if (request.command == 'flags') { |
1453 this.debuggerFlagsRequest_(request, response); | 1455 this.debuggerFlagsRequest_(request, response); |
1454 } else if (request.command == 'v8flags') { | 1456 } else if (request.command == 'v8flags') { |
1455 this.v8FlagsRequest_(request, response); | 1457 this.v8FlagsRequest_(request, response); |
1456 | 1458 |
1457 // GC tools: | 1459 // GC tools: |
1458 } else if (request.command == 'gc') { | 1460 } else if (request.command == 'gc') { |
1459 this.gcRequest_(request, response); | 1461 this.gcRequest_(request, response); |
1460 | 1462 |
1461 // LiveObjectList tools: | 1463 // LiveObjectList tools: |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2351 %ProfilerPause(); | 2353 %ProfilerPause(); |
2352 } else { | 2354 } else { |
2353 return response.failed('Unknown command'); | 2355 return response.failed('Unknown command'); |
2354 } | 2356 } |
2355 response.body = {}; | 2357 response.body = {}; |
2356 }; | 2358 }; |
2357 | 2359 |
2358 | 2360 |
2359 DebugCommandProcessor.prototype.changeLiveRequest_ = function( | 2361 DebugCommandProcessor.prototype.changeLiveRequest_ = function( |
2360 request, response) { | 2362 request, response) { |
2361 if (!Debug.LiveEdit) { | |
2362 return response.failed('LiveEdit feature is not supported'); | |
2363 } | |
2364 if (!request.arguments) { | 2363 if (!request.arguments) { |
2365 return response.failed('Missing arguments'); | 2364 return response.failed('Missing arguments'); |
2366 } | 2365 } |
2367 var script_id = request.arguments.script_id; | 2366 var script_id = request.arguments.script_id; |
2368 var preview_only = !!request.arguments.preview_only; | 2367 var preview_only = !!request.arguments.preview_only; |
2369 | 2368 |
2370 var scripts = %DebugGetLoadedScripts(); | 2369 var scripts = %DebugGetLoadedScripts(); |
2371 | 2370 |
2372 var the_script = null; | 2371 var the_script = null; |
2373 for (var i = 0; i < scripts.length; i++) { | 2372 for (var i = 0; i < scripts.length; i++) { |
(...skipping 17 matching lines...) Expand all Loading... | |
2391 var result_description = Debug.LiveEdit.SetScriptSource(the_script, | 2390 var result_description = Debug.LiveEdit.SetScriptSource(the_script, |
2392 new_source, preview_only, change_log); | 2391 new_source, preview_only, change_log); |
2393 response.body = {change_log: change_log, result: result_description}; | 2392 response.body = {change_log: change_log, result: result_description}; |
2394 | 2393 |
2395 if (!preview_only && !this.running_ && result_description.stack_modified) { | 2394 if (!preview_only && !this.running_ && result_description.stack_modified) { |
2396 response.body.stepin_recommended = true; | 2395 response.body.stepin_recommended = true; |
2397 } | 2396 } |
2398 }; | 2397 }; |
2399 | 2398 |
2400 | 2399 |
2400 DebugCommandProcessor.prototype.restartFrameRequest_ = function( | |
2401 request, response) { | |
2402 if (!request.arguments) { | |
2403 return response.failed('Missing arguments'); | |
2404 } | |
2405 var frame = request.arguments.frame; | |
2406 | |
2407 // No frames no evaluate in frame. | |
Yang
2012/06/14 09:09:28
"to evaluate"?
Peter Rybin
2012/06/14 22:08:03
Done.
| |
2408 if (this.exec_state_.frameCount() == 0) { | |
2409 return response.failed('No frames'); | |
2410 } | |
2411 | |
2412 var frame_mirror; | |
2413 // Check whether a frame was specified. | |
2414 if (!IS_UNDEFINED(frame)) { | |
2415 var frame_number = %ToNumber(frame); | |
2416 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { | |
2417 return response.failed('Invalid frame "' + frame + '"'); | |
2418 } | |
2419 // Restart specified frame. | |
2420 frame_mirror = this.exec_state_.frame(frame_number); | |
2421 } else { | |
2422 // Restart selected frame. | |
2423 frame_mirror = this.exec_state_.frame(); | |
2424 } | |
2425 | |
2426 var result_description = Debug.LiveEdit.RestartFrame(frame_mirror); | |
2427 response.body = {result: result_description}; | |
2428 }; | |
2429 | |
2430 | |
2401 DebugCommandProcessor.prototype.debuggerFlagsRequest_ = function(request, | 2431 DebugCommandProcessor.prototype.debuggerFlagsRequest_ = function(request, |
2402 response) { | 2432 response) { |
2403 // Check for legal request. | 2433 // Check for legal request. |
2404 if (!request.arguments) { | 2434 if (!request.arguments) { |
2405 response.failed('Missing arguments'); | 2435 response.failed('Missing arguments'); |
2406 return; | 2436 return; |
2407 } | 2437 } |
2408 | 2438 |
2409 // Pull out arguments. | 2439 // Pull out arguments. |
2410 var flags = request.arguments.flags; | 2440 var flags = request.arguments.flags; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2626 case 'string': | 2656 case 'string': |
2627 case 'number': | 2657 case 'number': |
2628 json = value; | 2658 json = value; |
2629 break; | 2659 break; |
2630 | 2660 |
2631 default: | 2661 default: |
2632 json = null; | 2662 json = null; |
2633 } | 2663 } |
2634 return json; | 2664 return json; |
2635 } | 2665 } |
OLD | NEW |