Chromium Code Reviews| 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)); | |
|
Søren Thygesen Gjesse
2011/01/19 08:36:40
I think we should be able to unify the handles ids
marklam
2011/01/19 09:04:02
The problem with that is that the @ids only work i
| |
| 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_ = function(request, response) { | |
|
Søren Thygesen Gjesse
2011/01/19 08:36:40
We try to split the long lines when possible, e.g.
marklam
2011/01/19 09:04:02
Done.
| |
| 2388 response.body = %CaptureLOL(); | |
| 2389 }; | |
| 2390 | |
| 2391 | |
| 2392 DebugCommandProcessor.prototype.lolDeleteRequest_ = function(request, response) { | |
|
Søren Thygesen Gjesse
2011/01/19 08:36:40
Ditto.
marklam
2011/01/19 09:04:02
Done.
| |
| 2393 var id = request.arguments.id; | |
| 2394 var result = %DeleteLOL(id); | |
| 2395 if (result) { | |
| 2396 response.body = { id: id }; | |
| 2397 } else { | |
| 2398 response.failed('Failed to delete: live object list ' + id + ' not found.'); | |
| 2399 } | |
| 2400 }; | |
| 2401 | |
| 2402 | |
| 2403 DebugCommandProcessor.prototype.lolDiffRequest_ = function(request, response) { | |
| 2404 var id1 = request.arguments.id1; | |
| 2405 var id2 = request.arguments.id2; | |
| 2406 var verbose = request.arguments.verbose; | |
| 2407 var filter = request.arguments.filter; | |
| 2408 if (verbose === true) { | |
| 2409 var start = request.arguments.start; | |
| 2410 var count = request.arguments.count; | |
| 2411 response.body = %DumpLOL(id1, id2, start, count, filter); | |
| 2412 } else { | |
| 2413 response.body = %SummarizeLOL(id1, id2, filter); | |
| 2414 } | |
| 2415 }; | |
| 2416 | |
| 2417 | |
| 2418 DebugCommandProcessor.prototype.lolGetIdRequest_ = function(request, response) { | |
| 2419 var address = request.arguments.address; | |
| 2420 response.body = {}; | |
| 2421 response.body.id = %GetLOLObjId(address); | |
| 2422 }; | |
| 2423 | |
| 2424 | |
| 2425 DebugCommandProcessor.prototype.lolInfoRequest_ = function(request, response) { | |
| 2426 var start = request.arguments.start; | |
| 2427 var count = request.arguments.count; | |
| 2428 response.body = %InfoLOL(start, count); | |
| 2429 }; | |
| 2430 | |
| 2431 | |
| 2432 DebugCommandProcessor.prototype.lolResetRequest_ = function(request, response) { | |
| 2433 %ResetLOL(); | |
| 2434 }; | |
| 2435 | |
| 2436 | |
| 2437 DebugCommandProcessor.prototype.lolRetainersRequest_ = function(request, respons e) { | |
|
Søren Thygesen Gjesse
2011/01/19 08:36:40
Ditto.
marklam
2011/01/19 09:04:02
Done.
| |
| 2438 var id = request.arguments.id; | |
| 2439 var verbose = request.arguments.verbose; | |
| 2440 var start = request.arguments.start; | |
| 2441 var count = request.arguments.count; | |
| 2442 var filter = request.arguments.filter; | |
| 2443 | |
| 2444 response.body = %GetLOLObjRetainers(id, Mirror.prototype, verbose, | |
| 2445 start, count, filter); | |
| 2446 }; | |
| 2447 | |
| 2448 | |
| 2449 DebugCommandProcessor.prototype.lolPathRequest_ = function(request, response) { | |
| 2450 var id1 = request.arguments.id1; | |
| 2451 var id2 = request.arguments.id2; | |
| 2452 response.body = {}; | |
| 2453 response.body.path = %GetLOLPath(id1, id2, Mirror.prototype); | |
| 2454 }; | |
| 2455 | |
| 2456 | |
| 2457 DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) { | |
| 2458 var id = request.arguments.id; | |
| 2459 response.body = {}; | |
| 2460 response.body.dump = %PrintLOLObj(id); | |
| 2461 }; | |
| 2344 | 2462 |
| 2345 | 2463 |
| 2346 // Check whether the previously processed command caused the VM to become | 2464 // Check whether the previously processed command caused the VM to become |
| 2347 // running. | 2465 // running. |
| 2348 DebugCommandProcessor.prototype.isRunning = function() { | 2466 DebugCommandProcessor.prototype.isRunning = function() { |
| 2349 return this.running_; | 2467 return this.running_; |
| 2350 } | 2468 } |
| 2351 | 2469 |
| 2352 | 2470 |
| 2353 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { | 2471 DebugCommandProcessor.prototype.systemBreak = function(cmd, args) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2439 case 'string': | 2557 case 'string': |
| 2440 case 'number': | 2558 case 'number': |
| 2441 json = value; | 2559 json = value; |
| 2442 break | 2560 break |
| 2443 | 2561 |
| 2444 default: | 2562 default: |
| 2445 json = null; | 2563 json = null; |
| 2446 } | 2564 } |
| 2447 return json; | 2565 return json; |
| 2448 } | 2566 } |
| OLD | NEW |