| 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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 return request.toJSONProtocol(); | 1112 return request.toJSONProtocol(); |
| 1113 }; | 1113 }; |
| 1114 | 1114 |
| 1115 | 1115 |
| 1116 // Convert a JSON response to text for display in a text based debugger. | 1116 // Convert a JSON response to text for display in a text based debugger. |
| 1117 DebugCommandProcessor.prototype.responseToText = function(json_response) { | 1117 DebugCommandProcessor.prototype.responseToText = function(json_response) { |
| 1118 try { | 1118 try { |
| 1119 // Convert the JSON string to an object. | 1119 // Convert the JSON string to an object. |
| 1120 response = %CompileString('(' + json_response + ')', 0, false)(); | 1120 response = %CompileString('(' + json_response + ')', 0)(); |
| 1121 | 1121 |
| 1122 if (!response.success) { | 1122 if (!response.success) { |
| 1123 return response.message; | 1123 return response.message; |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 if (response.command == 'backtrace') { | 1126 if (response.command == 'backtrace') { |
| 1127 var body = response.body; | 1127 var body = response.body; |
| 1128 var result = 'Frames #' + body.fromFrame + ' to #' + | 1128 var result = 'Frames #' + body.fromFrame + ' to #' + |
| 1129 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n'; | 1129 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n'; |
| 1130 for (i = 0; i < body.frames.length; i++) { | 1130 for (i = 0; i < body.frames.length; i++) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1316 return new ResponsePacket(request); | 1316 return new ResponsePacket(request); |
| 1317 }; | 1317 }; |
| 1318 | 1318 |
| 1319 | 1319 |
| 1320 DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request,
stopping) { | 1320 DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request,
stopping) { |
| 1321 var request; // Current request. | 1321 var request; // Current request. |
| 1322 var response; // Generated response. | 1322 var response; // Generated response. |
| 1323 try { | 1323 try { |
| 1324 try { | 1324 try { |
| 1325 // Convert the JSON string to an object. | 1325 // Convert the JSON string to an object. |
| 1326 request = %CompileString('(' + json_request + ')', 0, false)(); | 1326 request = %CompileString('(' + json_request + ')', 0)(); |
| 1327 | 1327 |
| 1328 // Create an initial response. | 1328 // Create an initial response. |
| 1329 response = this.createResponse(request); | 1329 response = this.createResponse(request); |
| 1330 | 1330 |
| 1331 if (!request.type) { | 1331 if (!request.type) { |
| 1332 throw new Error('Type not specified'); | 1332 throw new Error('Type not specified'); |
| 1333 } | 1333 } |
| 1334 | 1334 |
| 1335 if (request.type != 'request') { | 1335 if (request.type != 'request') { |
| 1336 throw new Error("Illegal type '" + request.type + "' in request"); | 1336 throw new Error("Illegal type '" + request.type + "' in request"); |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 response.body.push(script); | 1769 response.body.push(script); |
| 1770 } | 1770 } |
| 1771 } | 1771 } |
| 1772 }; | 1772 }; |
| 1773 | 1773 |
| 1774 | 1774 |
| 1775 // Check whether the JSON response indicate that the VM should be running. | 1775 // Check whether the JSON response indicate that the VM should be running. |
| 1776 DebugCommandProcessor.prototype.isRunning = function(json_response) { | 1776 DebugCommandProcessor.prototype.isRunning = function(json_response) { |
| 1777 try { | 1777 try { |
| 1778 // Convert the JSON string to an object. | 1778 // Convert the JSON string to an object. |
| 1779 response = %CompileString('(' + json_response + ')', 0, false)(); | 1779 response = %CompileString('(' + json_response + ')', 0)(); |
| 1780 | 1780 |
| 1781 // Return whether VM should be running after this request. | 1781 // Return whether VM should be running after this request. |
| 1782 return response.running; | 1782 return response.running; |
| 1783 | 1783 |
| 1784 } catch (e) { | 1784 } catch (e) { |
| 1785 return false; | 1785 return false; |
| 1786 } | 1786 } |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 | 1789 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 json += NumberToJSON_(elem); | 1908 json += NumberToJSON_(elem); |
| 1909 } else if (IS_STRING(elem)) { | 1909 } else if (IS_STRING(elem)) { |
| 1910 json += StringToJSON_(elem); | 1910 json += StringToJSON_(elem); |
| 1911 } else { | 1911 } else { |
| 1912 json += elem; | 1912 json += elem; |
| 1913 } | 1913 } |
| 1914 } | 1914 } |
| 1915 json += ']'; | 1915 json += ']'; |
| 1916 return json; | 1916 return json; |
| 1917 } | 1917 } |
| OLD | NEW |