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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 } else if (request.command == 'changebreakpoint') { | 1064 } else if (request.command == 'changebreakpoint') { |
1065 this.changeBreakPointRequest_(request, response); | 1065 this.changeBreakPointRequest_(request, response); |
1066 } else if (request.command == 'clearbreakpoint') { | 1066 } else if (request.command == 'clearbreakpoint') { |
1067 this.clearBreakPointRequest_(request, response); | 1067 this.clearBreakPointRequest_(request, response); |
1068 } else if (request.command == 'backtrace') { | 1068 } else if (request.command == 'backtrace') { |
1069 this.backtraceRequest_(request, response); | 1069 this.backtraceRequest_(request, response); |
1070 } else if (request.command == 'frame') { | 1070 } else if (request.command == 'frame') { |
1071 this.frameRequest_(request, response); | 1071 this.frameRequest_(request, response); |
1072 } else if (request.command == 'evaluate') { | 1072 } else if (request.command == 'evaluate') { |
1073 this.evaluateRequest_(request, response); | 1073 this.evaluateRequest_(request, response); |
| 1074 } else if (request.command == 'lookup') { |
| 1075 this.lookupRequest_(request, response); |
1074 } else if (request.command == 'source') { | 1076 } else if (request.command == 'source') { |
1075 this.sourceRequest_(request, response); | 1077 this.sourceRequest_(request, response); |
1076 } else if (request.command == 'scripts') { | 1078 } else if (request.command == 'scripts') { |
1077 this.scriptsRequest_(request, response); | 1079 this.scriptsRequest_(request, response); |
1078 } else { | 1080 } else { |
1079 throw new Error('Unknown command "' + request.command + '" in request'); | 1081 throw new Error('Unknown command "' + request.command + '" in request'); |
1080 } | 1082 } |
1081 } catch (e) { | 1083 } catch (e) { |
1082 // If there is no response object created one (without command). | 1084 // If there is no response object created one (without command). |
1083 if (!response) { | 1085 if (!response) { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 return; | 1429 return; |
1428 } else { | 1430 } else { |
1429 // Evaluate in the selected frame. | 1431 // Evaluate in the selected frame. |
1430 response.body = this.exec_state_.frame().evaluate( | 1432 response.body = this.exec_state_.frame().evaluate( |
1431 expression, Boolean(disable_break)); | 1433 expression, Boolean(disable_break)); |
1432 return; | 1434 return; |
1433 } | 1435 } |
1434 }; | 1436 }; |
1435 | 1437 |
1436 | 1438 |
| 1439 DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) { |
| 1440 if (!request.arguments) { |
| 1441 return response.failed('Missing arguments'); |
| 1442 } |
| 1443 |
| 1444 // Pull out arguments. |
| 1445 var handle = request.arguments.handle; |
| 1446 |
| 1447 // Check for legal arguments. |
| 1448 if (IS_UNDEFINED(handle)) { |
| 1449 return response.failed('Argument "handle" missing'); |
| 1450 } |
| 1451 |
| 1452 // Lookup handle. |
| 1453 var mirror = LookupMirror(handle); |
| 1454 if (mirror) { |
| 1455 response.body = mirror; |
| 1456 } else { |
| 1457 return response.failed('Object #' + handle + '# not found'); |
| 1458 } |
| 1459 }; |
| 1460 |
| 1461 |
1437 DebugCommandProcessor.prototype.sourceRequest_ = function(request, response) { | 1462 DebugCommandProcessor.prototype.sourceRequest_ = function(request, response) { |
1438 // No frames no source. | 1463 // No frames no source. |
1439 if (this.exec_state_.frameCount() == 0) { | 1464 if (this.exec_state_.frameCount() == 0) { |
1440 return response.failed('No source'); | 1465 return response.failed('No source'); |
1441 } | 1466 } |
1442 | 1467 |
1443 var from_line; | 1468 var from_line; |
1444 var to_line; | 1469 var to_line; |
1445 var frame = this.exec_state_.frame(); | 1470 var frame = this.exec_state_.frame(); |
1446 if (request.arguments) { | 1471 if (request.arguments) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 json += NumberToJSON_(elem); | 1678 json += NumberToJSON_(elem); |
1654 } else if (IS_STRING(elem)) { | 1679 } else if (IS_STRING(elem)) { |
1655 json += StringToJSON_(elem); | 1680 json += StringToJSON_(elem); |
1656 } else { | 1681 } else { |
1657 json += elem; | 1682 json += elem; |
1658 } | 1683 } |
1659 } | 1684 } |
1660 json += ']'; | 1685 json += ']'; |
1661 return json; | 1686 return json; |
1662 } | 1687 } |
OLD | NEW |