| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 getValue: function() { return Debug.isBreakOnUncaughtException(); }, | 103 getValue: function() { return Debug.isBreakOnUncaughtException(); }, |
| 104 setValue: function(value) { | 104 setValue: function(value) { |
| 105 if (value) { | 105 if (value) { |
| 106 Debug.setBreakOnUncaughtException(); | 106 Debug.setBreakOnUncaughtException(); |
| 107 } else { | 107 } else { |
| 108 Debug.clearBreakOnUncaughtException(); | 108 Debug.clearBreakOnUncaughtException(); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 }, | 111 }, |
| 112 }; | 112 }; |
| 113 var lol_is_enabled = %HasLOLEnabled(); | |
| 114 | 113 |
| 115 | 114 |
| 116 // Create a new break point object and add it to the list of break points. | 115 // Create a new break point object and add it to the list of break points. |
| 117 function MakeBreakPoint(source_position, opt_script_break_point) { | 116 function MakeBreakPoint(source_position, opt_script_break_point) { |
| 118 var break_point = new BreakPoint(source_position, opt_script_break_point); | 117 var break_point = new BreakPoint(source_position, opt_script_break_point); |
| 119 break_points.push(break_point); | 118 break_points.push(break_point); |
| 120 return break_point; | 119 return break_point; |
| 121 } | 120 } |
| 122 | 121 |
| 123 | 122 |
| (...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 } else if (request.command == 'frame') { | 1429 } else if (request.command == 'frame') { |
| 1431 this.frameRequest_(request, response); | 1430 this.frameRequest_(request, response); |
| 1432 } else if (request.command == 'scopes') { | 1431 } else if (request.command == 'scopes') { |
| 1433 this.scopesRequest_(request, response); | 1432 this.scopesRequest_(request, response); |
| 1434 } else if (request.command == 'scope') { | 1433 } else if (request.command == 'scope') { |
| 1435 this.scopeRequest_(request, response); | 1434 this.scopeRequest_(request, response); |
| 1436 } else if (request.command == 'setVariableValue') { | 1435 } else if (request.command == 'setVariableValue') { |
| 1437 this.setVariableValueRequest_(request, response); | 1436 this.setVariableValueRequest_(request, response); |
| 1438 } else if (request.command == 'evaluate') { | 1437 } else if (request.command == 'evaluate') { |
| 1439 this.evaluateRequest_(request, response); | 1438 this.evaluateRequest_(request, response); |
| 1440 } else if (lol_is_enabled && request.command == 'getobj') { | |
| 1441 this.getobjRequest_(request, response); | |
| 1442 } else if (request.command == 'lookup') { | 1439 } else if (request.command == 'lookup') { |
| 1443 this.lookupRequest_(request, response); | 1440 this.lookupRequest_(request, response); |
| 1444 } else if (request.command == 'references') { | 1441 } else if (request.command == 'references') { |
| 1445 this.referencesRequest_(request, response); | 1442 this.referencesRequest_(request, response); |
| 1446 } else if (request.command == 'source') { | 1443 } else if (request.command == 'source') { |
| 1447 this.sourceRequest_(request, response); | 1444 this.sourceRequest_(request, response); |
| 1448 } else if (request.command == 'scripts') { | 1445 } else if (request.command == 'scripts') { |
| 1449 this.scriptsRequest_(request, response); | 1446 this.scriptsRequest_(request, response); |
| 1450 } else if (request.command == 'threads') { | 1447 } else if (request.command == 'threads') { |
| 1451 this.threadsRequest_(request, response); | 1448 this.threadsRequest_(request, response); |
| 1452 } else if (request.command == 'suspend') { | 1449 } else if (request.command == 'suspend') { |
| 1453 this.suspendRequest_(request, response); | 1450 this.suspendRequest_(request, response); |
| 1454 } else if (request.command == 'version') { | 1451 } else if (request.command == 'version') { |
| 1455 this.versionRequest_(request, response); | 1452 this.versionRequest_(request, response); |
| 1456 } else if (request.command == 'profile') { | 1453 } else if (request.command == 'profile') { |
| 1457 this.profileRequest_(request, response); | 1454 this.profileRequest_(request, response); |
| 1458 } else if (request.command == 'changelive') { | 1455 } else if (request.command == 'changelive') { |
| 1459 this.changeLiveRequest_(request, response); | 1456 this.changeLiveRequest_(request, response); |
| 1460 } else if (request.command == 'restartframe') { | 1457 } else if (request.command == 'restartframe') { |
| 1461 this.restartFrameRequest_(request, response); | 1458 this.restartFrameRequest_(request, response); |
| 1462 } else if (request.command == 'flags') { | 1459 } else if (request.command == 'flags') { |
| 1463 this.debuggerFlagsRequest_(request, response); | 1460 this.debuggerFlagsRequest_(request, response); |
| 1464 } else if (request.command == 'v8flags') { | 1461 } else if (request.command == 'v8flags') { |
| 1465 this.v8FlagsRequest_(request, response); | 1462 this.v8FlagsRequest_(request, response); |
| 1466 | 1463 |
| 1467 // GC tools: | 1464 // GC tools: |
| 1468 } else if (request.command == 'gc') { | 1465 } else if (request.command == 'gc') { |
| 1469 this.gcRequest_(request, response); | 1466 this.gcRequest_(request, response); |
| 1470 | 1467 |
| 1471 // LiveObjectList tools: | |
| 1472 } else if (lol_is_enabled && request.command == 'lol-capture') { | |
| 1473 this.lolCaptureRequest_(request, response); | |
| 1474 } else if (lol_is_enabled && request.command == 'lol-delete') { | |
| 1475 this.lolDeleteRequest_(request, response); | |
| 1476 } else if (lol_is_enabled && request.command == 'lol-diff') { | |
| 1477 this.lolDiffRequest_(request, response); | |
| 1478 } else if (lol_is_enabled && request.command == 'lol-getid') { | |
| 1479 this.lolGetIdRequest_(request, response); | |
| 1480 } else if (lol_is_enabled && request.command == 'lol-info') { | |
| 1481 this.lolInfoRequest_(request, response); | |
| 1482 } else if (lol_is_enabled && request.command == 'lol-reset') { | |
| 1483 this.lolResetRequest_(request, response); | |
| 1484 } else if (lol_is_enabled && request.command == 'lol-retainers') { | |
| 1485 this.lolRetainersRequest_(request, response); | |
| 1486 } else if (lol_is_enabled && request.command == 'lol-path') { | |
| 1487 this.lolPathRequest_(request, response); | |
| 1488 } else if (lol_is_enabled && request.command == 'lol-print') { | |
| 1489 this.lolPrintRequest_(request, response); | |
| 1490 } else if (lol_is_enabled && request.command == 'lol-stats') { | |
| 1491 this.lolStatsRequest_(request, response); | |
| 1492 | |
| 1493 } else { | 1468 } else { |
| 1494 throw new Error('Unknown command "' + request.command + '" in request'); | 1469 throw new Error('Unknown command "' + request.command + '" in request'); |
| 1495 } | 1470 } |
| 1496 } catch (e) { | 1471 } catch (e) { |
| 1497 // If there is no response object created one (without command). | 1472 // If there is no response object created one (without command). |
| 1498 if (!response) { | 1473 if (!response) { |
| 1499 response = this.createResponse(); | 1474 response = this.createResponse(); |
| 1500 } | 1475 } |
| 1501 response.success = false; | 1476 response.success = false; |
| 1502 response.message = %ToString(e); | 1477 response.message = %ToString(e); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 return; | 2159 return; |
| 2185 } else { | 2160 } else { |
| 2186 // Evaluate in the selected frame. | 2161 // Evaluate in the selected frame. |
| 2187 response.body = this.exec_state_.frame().evaluate( | 2162 response.body = this.exec_state_.frame().evaluate( |
| 2188 expression, Boolean(disable_break), additional_context_object); | 2163 expression, Boolean(disable_break), additional_context_object); |
| 2189 return; | 2164 return; |
| 2190 } | 2165 } |
| 2191 }; | 2166 }; |
| 2192 | 2167 |
| 2193 | 2168 |
| 2194 DebugCommandProcessor.prototype.getobjRequest_ = function(request, response) { | |
| 2195 if (!request.arguments) { | |
| 2196 return response.failed('Missing arguments'); | |
| 2197 } | |
| 2198 | |
| 2199 // Pull out arguments. | |
| 2200 var obj_id = request.arguments.obj_id; | |
| 2201 | |
| 2202 // Check for legal arguments. | |
| 2203 if (IS_UNDEFINED(obj_id)) { | |
| 2204 return response.failed('Argument "obj_id" missing'); | |
| 2205 } | |
| 2206 | |
| 2207 // Dump the object. | |
| 2208 response.body = MakeMirror(%GetLOLObj(obj_id)); | |
| 2209 }; | |
| 2210 | |
| 2211 | |
| 2212 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { | 2169 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { |
| 2213 if (!request.arguments) { | 2170 if (!request.arguments) { |
| 2214 return response.failed('Missing arguments'); | 2171 return response.failed('Missing arguments'); |
| 2215 } | 2172 } |
| 2216 | 2173 |
| 2217 // Pull out arguments. | 2174 // Pull out arguments. |
| 2218 var handles = request.arguments.handles; | 2175 var handles = request.arguments.handles; |
| 2219 | 2176 |
| 2220 // Check for legal arguments. | 2177 // Check for legal arguments. |
| 2221 if (IS_UNDEFINED(handles)) { | 2178 if (IS_UNDEFINED(handles)) { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 if (!type) type = 'all'; | 2517 if (!type) type = 'all'; |
| 2561 | 2518 |
| 2562 var before = %GetHeapUsage(); | 2519 var before = %GetHeapUsage(); |
| 2563 %CollectGarbage(type); | 2520 %CollectGarbage(type); |
| 2564 var after = %GetHeapUsage(); | 2521 var after = %GetHeapUsage(); |
| 2565 | 2522 |
| 2566 response.body = { "before": before, "after": after }; | 2523 response.body = { "before": before, "after": after }; |
| 2567 }; | 2524 }; |
| 2568 | 2525 |
| 2569 | 2526 |
| 2570 DebugCommandProcessor.prototype.lolCaptureRequest_ = | |
| 2571 function(request, response) { | |
| 2572 response.body = %CaptureLOL(); | |
| 2573 }; | |
| 2574 | |
| 2575 | |
| 2576 DebugCommandProcessor.prototype.lolDeleteRequest_ = | |
| 2577 function(request, response) { | |
| 2578 var id = request.arguments.id; | |
| 2579 var result = %DeleteLOL(id); | |
| 2580 if (result) { | |
| 2581 response.body = { id: id }; | |
| 2582 } else { | |
| 2583 response.failed('Failed to delete: live object list ' + id + ' not found.'); | |
| 2584 } | |
| 2585 }; | |
| 2586 | |
| 2587 | |
| 2588 DebugCommandProcessor.prototype.lolDiffRequest_ = function(request, response) { | |
| 2589 var id1 = request.arguments.id1; | |
| 2590 var id2 = request.arguments.id2; | |
| 2591 var verbose = request.arguments.verbose; | |
| 2592 var filter = request.arguments.filter; | |
| 2593 if (verbose === true) { | |
| 2594 var start = request.arguments.start; | |
| 2595 var count = request.arguments.count; | |
| 2596 response.body = %DumpLOL(id1, id2, start, count, filter); | |
| 2597 } else { | |
| 2598 response.body = %SummarizeLOL(id1, id2, filter); | |
| 2599 } | |
| 2600 }; | |
| 2601 | |
| 2602 | |
| 2603 DebugCommandProcessor.prototype.lolGetIdRequest_ = function(request, response) { | |
| 2604 var address = request.arguments.address; | |
| 2605 response.body = {}; | |
| 2606 response.body.id = %GetLOLObjId(address); | |
| 2607 }; | |
| 2608 | |
| 2609 | |
| 2610 DebugCommandProcessor.prototype.lolInfoRequest_ = function(request, response) { | |
| 2611 var start = request.arguments.start; | |
| 2612 var count = request.arguments.count; | |
| 2613 response.body = %InfoLOL(start, count); | |
| 2614 }; | |
| 2615 | |
| 2616 | |
| 2617 DebugCommandProcessor.prototype.lolResetRequest_ = function(request, response) { | |
| 2618 %ResetLOL(); | |
| 2619 }; | |
| 2620 | |
| 2621 | |
| 2622 DebugCommandProcessor.prototype.lolRetainersRequest_ = | |
| 2623 function(request, response) { | |
| 2624 var id = request.arguments.id; | |
| 2625 var verbose = request.arguments.verbose; | |
| 2626 var start = request.arguments.start; | |
| 2627 var count = request.arguments.count; | |
| 2628 var filter = request.arguments.filter; | |
| 2629 | |
| 2630 response.body = %GetLOLObjRetainers(id, Mirror.prototype, verbose, | |
| 2631 start, count, filter); | |
| 2632 }; | |
| 2633 | |
| 2634 | |
| 2635 DebugCommandProcessor.prototype.lolPathRequest_ = function(request, response) { | |
| 2636 var id1 = request.arguments.id1; | |
| 2637 var id2 = request.arguments.id2; | |
| 2638 response.body = {}; | |
| 2639 response.body.path = %GetLOLPath(id1, id2, Mirror.prototype); | |
| 2640 }; | |
| 2641 | |
| 2642 | |
| 2643 DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) { | |
| 2644 var id = request.arguments.id; | |
| 2645 response.body = {}; | |
| 2646 response.body.dump = %PrintLOLObj(id); | |
| 2647 }; | |
| 2648 | |
| 2649 | |
| 2650 // Check whether the previously processed command caused the VM to become | 2527 // Check whether the previously processed command caused the VM to become |
| 2651 // running. | 2528 // running. |
| 2652 DebugCommandProcessor.prototype.isRunning = function() { | 2529 DebugCommandProcessor.prototype.isRunning = function() { |
| 2653 return this.running_; | 2530 return this.running_; |
| 2654 }; | 2531 }; |
| 2655 | 2532 |
| 2656 | 2533 |
| 2657 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { | 2534 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { |
| 2658 return %SystemBreak(); | 2535 return %SystemBreak(); |
| 2659 }; | 2536 }; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2747 | 2624 |
| 2748 default: | 2625 default: |
| 2749 json = null; | 2626 json = null; |
| 2750 } | 2627 } |
| 2751 return json; | 2628 return json; |
| 2752 } | 2629 } |
| 2753 | 2630 |
| 2754 Debug.TestApi = { | 2631 Debug.TestApi = { |
| 2755 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2632 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
| 2756 }; | 2633 }; |
| OLD | NEW |