| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 102     getValue: function() { return Debug.isBreakOnUncaughtException(); }, | 102     getValue: function() { return Debug.isBreakOnUncaughtException(); }, | 
| 103     setValue: function(value) { | 103     setValue: function(value) { | 
| 104       if (value) { | 104       if (value) { | 
| 105         Debug.setBreakOnUncaughtException(); | 105         Debug.setBreakOnUncaughtException(); | 
| 106       } else { | 106       } else { | 
| 107         Debug.clearBreakOnUncaughtException(); | 107         Debug.clearBreakOnUncaughtException(); | 
| 108       } | 108       } | 
| 109     } | 109     } | 
| 110   }, | 110   }, | 
| 111 }; | 111 }; | 
|  | 112 var lol_is_enabled = %HasLOLEnabled(); | 
| 112 | 113 | 
| 113 | 114 | 
| 114 // 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. | 
| 115 function MakeBreakPoint(source_position, opt_script_break_point) { | 116 function MakeBreakPoint(source_position, opt_script_break_point) { | 
| 116   var break_point = new BreakPoint(source_position, opt_script_break_point); | 117   var break_point = new BreakPoint(source_position, opt_script_break_point); | 
| 117   break_points.push(break_point); | 118   break_points.push(break_point); | 
| 118   return break_point; | 119   return break_point; | 
| 119 } | 120 } | 
| 120 | 121 | 
| 121 | 122 | 
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1384       } else if (request.command == 'backtrace') { | 1385       } else if (request.command == 'backtrace') { | 
| 1385         this.backtraceRequest_(request, response); | 1386         this.backtraceRequest_(request, response); | 
| 1386       } else if (request.command == 'frame') { | 1387       } else if (request.command == 'frame') { | 
| 1387         this.frameRequest_(request, response); | 1388         this.frameRequest_(request, response); | 
| 1388       } else if (request.command == 'scopes') { | 1389       } else if (request.command == 'scopes') { | 
| 1389         this.scopesRequest_(request, response); | 1390         this.scopesRequest_(request, response); | 
| 1390       } else if (request.command == 'scope') { | 1391       } else if (request.command == 'scope') { | 
| 1391         this.scopeRequest_(request, response); | 1392         this.scopeRequest_(request, response); | 
| 1392       } else if (request.command == 'evaluate') { | 1393       } else if (request.command == 'evaluate') { | 
| 1393         this.evaluateRequest_(request, response); | 1394         this.evaluateRequest_(request, response); | 
|  | 1395       } else if (lol_is_enabled && request.command == 'getobj') { | 
|  | 1396         this.getobjRequest_(request, response); | 
| 1394       } else if (request.command == 'lookup') { | 1397       } else if (request.command == 'lookup') { | 
| 1395         this.lookupRequest_(request, response); | 1398         this.lookupRequest_(request, response); | 
| 1396       } else if (request.command == 'references') { | 1399       } else if (request.command == 'references') { | 
| 1397         this.referencesRequest_(request, response); | 1400         this.referencesRequest_(request, response); | 
| 1398       } else if (request.command == 'source') { | 1401       } else if (request.command == 'source') { | 
| 1399         this.sourceRequest_(request, response); | 1402         this.sourceRequest_(request, response); | 
| 1400       } else if (request.command == 'scripts') { | 1403       } else if (request.command == 'scripts') { | 
| 1401         this.scriptsRequest_(request, response); | 1404         this.scriptsRequest_(request, response); | 
| 1402       } else if (request.command == 'threads') { | 1405       } else if (request.command == 'threads') { | 
| 1403         this.threadsRequest_(request, response); | 1406         this.threadsRequest_(request, response); | 
| 1404       } else if (request.command == 'suspend') { | 1407       } else if (request.command == 'suspend') { | 
| 1405         this.suspendRequest_(request, response); | 1408         this.suspendRequest_(request, response); | 
| 1406       } else if (request.command == 'version') { | 1409       } else if (request.command == 'version') { | 
| 1407         this.versionRequest_(request, response); | 1410         this.versionRequest_(request, response); | 
| 1408       } else if (request.command == 'profile') { | 1411       } else if (request.command == 'profile') { | 
| 1409         this.profileRequest_(request, response); | 1412         this.profileRequest_(request, response); | 
| 1410       } else if (request.command == 'changelive') { | 1413       } else if (request.command == 'changelive') { | 
| 1411         this.changeLiveRequest_(request, response); | 1414         this.changeLiveRequest_(request, response); | 
| 1412       } else if (request.command == 'flags') { | 1415       } else if (request.command == 'flags') { | 
| 1413         this.debuggerFlagsRequest_(request, response); | 1416         this.debuggerFlagsRequest_(request, response); | 
| 1414       } else if (request.command == 'v8flags') { | 1417       } else if (request.command == 'v8flags') { | 
| 1415         this.v8FlagsRequest_(request, response); | 1418         this.v8FlagsRequest_(request, response); | 
| 1416 | 1419 | 
| 1417       // GC tools: | 1420       // GC tools: | 
| 1418       } else if (request.command == 'gc') { | 1421       } else if (request.command == 'gc') { | 
| 1419         this.gcRequest_(request, response); | 1422         this.gcRequest_(request, response); | 
| 1420 | 1423 | 
|  | 1424       // LiveObjectList tools: | 
|  | 1425       } else if (lol_is_enabled && request.command == 'lol-capture') { | 
|  | 1426         this.lolCaptureRequest_(request, response); | 
|  | 1427       } else if (lol_is_enabled && request.command == 'lol-delete') { | 
|  | 1428         this.lolDeleteRequest_(request, response); | 
|  | 1429       } else if (lol_is_enabled && request.command == 'lol-diff') { | 
|  | 1430         this.lolDiffRequest_(request, response); | 
|  | 1431       } else if (lol_is_enabled && request.command == 'lol-getid') { | 
|  | 1432         this.lolGetIdRequest_(request, response); | 
|  | 1433       } else if (lol_is_enabled && request.command == 'lol-info') { | 
|  | 1434         this.lolInfoRequest_(request, response); | 
|  | 1435       } else if (lol_is_enabled && request.command == 'lol-reset') { | 
|  | 1436         this.lolResetRequest_(request, response); | 
|  | 1437       } else if (lol_is_enabled && request.command == 'lol-retainers') { | 
|  | 1438         this.lolRetainersRequest_(request, response); | 
|  | 1439       } else if (lol_is_enabled && request.command == 'lol-path') { | 
|  | 1440         this.lolPathRequest_(request, response); | 
|  | 1441       } else if (lol_is_enabled && request.command == 'lol-print') { | 
|  | 1442         this.lolPrintRequest_(request, response); | 
|  | 1443       } else if (lol_is_enabled && request.command == 'lol-stats') { | 
|  | 1444         this.lolStatsRequest_(request, response); | 
|  | 1445 | 
| 1421       } else { | 1446       } else { | 
| 1422         throw new Error('Unknown command "' + request.command + '" in request'); | 1447         throw new Error('Unknown command "' + request.command + '" in request'); | 
| 1423       } | 1448       } | 
| 1424     } catch (e) { | 1449     } catch (e) { | 
| 1425       // If there is no response object created one (without command). | 1450       // If there is no response object created one (without command). | 
| 1426       if (!response) { | 1451       if (!response) { | 
| 1427         response = this.createResponse(); | 1452         response = this.createResponse(); | 
| 1428       } | 1453       } | 
| 1429       response.success = false; | 1454       response.success = false; | 
| 1430       response.message = %ToString(e); | 1455       response.message = %ToString(e); | 
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2004     return; | 2029     return; | 
| 2005   } else { | 2030   } else { | 
| 2006     // Evaluate in the selected frame. | 2031     // Evaluate in the selected frame. | 
| 2007     response.body = this.exec_state_.frame().evaluate( | 2032     response.body = this.exec_state_.frame().evaluate( | 
| 2008         expression, Boolean(disable_break), additional_context_object); | 2033         expression, Boolean(disable_break), additional_context_object); | 
| 2009     return; | 2034     return; | 
| 2010   } | 2035   } | 
| 2011 }; | 2036 }; | 
| 2012 | 2037 | 
| 2013 | 2038 | 
|  | 2039 DebugCommandProcessor.prototype.getobjRequest_ = function(request, response) { | 
|  | 2040   if (!request.arguments) { | 
|  | 2041     return response.failed('Missing arguments'); | 
|  | 2042   } | 
|  | 2043 | 
|  | 2044   // Pull out arguments. | 
|  | 2045   var obj_id = request.arguments.obj_id; | 
|  | 2046 | 
|  | 2047   // Check for legal arguments. | 
|  | 2048   if (IS_UNDEFINED(obj_id)) { | 
|  | 2049     return response.failed('Argument "obj_id" missing'); | 
|  | 2050   } | 
|  | 2051 | 
|  | 2052   // Dump the object. | 
|  | 2053   response.body = MakeMirror(%GetLOLObj(obj_id)); | 
|  | 2054 }; | 
|  | 2055 | 
|  | 2056 | 
| 2014 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { | 2057 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { | 
| 2015   if (!request.arguments) { | 2058   if (!request.arguments) { | 
| 2016     return response.failed('Missing arguments'); | 2059     return response.failed('Missing arguments'); | 
| 2017   } | 2060   } | 
| 2018 | 2061 | 
| 2019   // Pull out arguments. | 2062   // Pull out arguments. | 
| 2020   var handles = request.arguments.handles; | 2063   var handles = request.arguments.handles; | 
| 2021 | 2064 | 
| 2022   // Check for legal arguments. | 2065   // Check for legal arguments. | 
| 2023   if (IS_UNDEFINED(handles)) { | 2066   if (IS_UNDEFINED(handles)) { | 
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2334   if (!type) type = 'all'; | 2377   if (!type) type = 'all'; | 
| 2335 | 2378 | 
| 2336   var before = %GetHeapUsage(); | 2379   var before = %GetHeapUsage(); | 
| 2337   %CollectGarbage(type); | 2380   %CollectGarbage(type); | 
| 2338   var after = %GetHeapUsage(); | 2381   var after = %GetHeapUsage(); | 
| 2339 | 2382 | 
| 2340   response.body = { "before": before, "after": after }; | 2383   response.body = { "before": before, "after": after }; | 
| 2341 }; | 2384 }; | 
| 2342 | 2385 | 
| 2343 | 2386 | 
|  | 2387 DebugCommandProcessor.prototype.lolCaptureRequest_ = | 
|  | 2388     function(request, response) { | 
|  | 2389   response.body = %CaptureLOL(); | 
|  | 2390 }; | 
|  | 2391 | 
|  | 2392 | 
|  | 2393 DebugCommandProcessor.prototype.lolDeleteRequest_ = | 
|  | 2394     function(request, response) { | 
|  | 2395   var id = request.arguments.id; | 
|  | 2396   var result = %DeleteLOL(id); | 
|  | 2397   if (result) { | 
|  | 2398     response.body = { id: id }; | 
|  | 2399   } else { | 
|  | 2400     response.failed('Failed to delete: live object list ' + id + ' not found.'); | 
|  | 2401   } | 
|  | 2402 }; | 
|  | 2403 | 
|  | 2404 | 
|  | 2405 DebugCommandProcessor.prototype.lolDiffRequest_ = function(request, response) { | 
|  | 2406   var id1 = request.arguments.id1; | 
|  | 2407   var id2 = request.arguments.id2; | 
|  | 2408   var verbose = request.arguments.verbose; | 
|  | 2409   var filter = request.arguments.filter; | 
|  | 2410   if (verbose === true) { | 
|  | 2411     var start = request.arguments.start; | 
|  | 2412     var count = request.arguments.count; | 
|  | 2413     response.body = %DumpLOL(id1, id2, start, count, filter); | 
|  | 2414   } else { | 
|  | 2415     response.body = %SummarizeLOL(id1, id2, filter); | 
|  | 2416   } | 
|  | 2417 }; | 
|  | 2418 | 
|  | 2419 | 
|  | 2420 DebugCommandProcessor.prototype.lolGetIdRequest_ = function(request, response) { | 
|  | 2421   var address = request.arguments.address; | 
|  | 2422   response.body = {}; | 
|  | 2423   response.body.id = %GetLOLObjId(address); | 
|  | 2424 }; | 
|  | 2425 | 
|  | 2426 | 
|  | 2427 DebugCommandProcessor.prototype.lolInfoRequest_ = function(request, response) { | 
|  | 2428   var start = request.arguments.start; | 
|  | 2429   var count = request.arguments.count; | 
|  | 2430   response.body = %InfoLOL(start, count); | 
|  | 2431 }; | 
|  | 2432 | 
|  | 2433 | 
|  | 2434 DebugCommandProcessor.prototype.lolResetRequest_ = function(request, response) { | 
|  | 2435   %ResetLOL(); | 
|  | 2436 }; | 
|  | 2437 | 
|  | 2438 | 
|  | 2439 DebugCommandProcessor.prototype.lolRetainersRequest_ = | 
|  | 2440     function(request, response) { | 
|  | 2441   var id = request.arguments.id; | 
|  | 2442   var verbose = request.arguments.verbose; | 
|  | 2443   var start = request.arguments.start; | 
|  | 2444   var count = request.arguments.count; | 
|  | 2445   var filter = request.arguments.filter; | 
|  | 2446 | 
|  | 2447   response.body = %GetLOLObjRetainers(id, Mirror.prototype, verbose, | 
|  | 2448                                       start, count, filter); | 
|  | 2449 }; | 
|  | 2450 | 
|  | 2451 | 
|  | 2452 DebugCommandProcessor.prototype.lolPathRequest_ = function(request, response) { | 
|  | 2453   var id1 = request.arguments.id1; | 
|  | 2454   var id2 = request.arguments.id2; | 
|  | 2455   response.body = {}; | 
|  | 2456   response.body.path = %GetLOLPath(id1, id2, Mirror.prototype); | 
|  | 2457 }; | 
|  | 2458 | 
|  | 2459 | 
|  | 2460 DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) { | 
|  | 2461   var id = request.arguments.id; | 
|  | 2462   response.body = {}; | 
|  | 2463   response.body.dump = %PrintLOLObj(id); | 
|  | 2464 }; | 
| 2344 | 2465 | 
| 2345 | 2466 | 
| 2346 // Check whether the previously processed command caused the VM to become | 2467 // Check whether the previously processed command caused the VM to become | 
| 2347 // running. | 2468 // running. | 
| 2348 DebugCommandProcessor.prototype.isRunning = function() { | 2469 DebugCommandProcessor.prototype.isRunning = function() { | 
| 2349   return this.running_; | 2470   return this.running_; | 
| 2350 } | 2471 } | 
| 2351 | 2472 | 
| 2352 | 2473 | 
| 2353 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { | 2474 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2439     case 'string': | 2560     case 'string': | 
| 2440     case 'number': | 2561     case 'number': | 
| 2441       json = value; | 2562       json = value; | 
| 2442       break | 2563       break | 
| 2443 | 2564 | 
| 2444     default: | 2565     default: | 
| 2445       json = null; | 2566       json = null; | 
| 2446   } | 2567   } | 
| 2447   return json; | 2568   return json; | 
| 2448 } | 2569 } | 
| OLD | NEW | 
|---|