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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 } | 1223 } |
1224 | 1224 |
1225 return request.toJSONProtocol(); | 1225 return request.toJSONProtocol(); |
1226 }; | 1226 }; |
1227 | 1227 |
1228 | 1228 |
1229 // Convert a JSON response to text for display in a text based debugger. | 1229 // Convert a JSON response to text for display in a text based debugger. |
1230 DebugCommandProcessor.prototype.responseToText = function(json_response) { | 1230 DebugCommandProcessor.prototype.responseToText = function(json_response) { |
1231 try { | 1231 try { |
1232 // Convert the JSON string to an object. | 1232 // Convert the JSON string to an object. |
1233 response = %CompileString('(' + json_response + ')', false)(); | 1233 response = %CompileString('(' + json_response + ')', 0, false)(); |
1234 | 1234 |
1235 if (!response.success) { | 1235 if (!response.success) { |
1236 return response.message; | 1236 return response.message; |
1237 } | 1237 } |
1238 | 1238 |
1239 if (response.command == 'backtrace') { | 1239 if (response.command == 'backtrace') { |
1240 var body = response.body; | 1240 var body = response.body; |
1241 var result = 'Frames #' + body.fromFrame + ' to #' + | 1241 var result = 'Frames #' + body.fromFrame + ' to #' + |
1242 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n'; | 1242 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n'; |
1243 for (i = 0; i < body.frames.length; i++) { | 1243 for (i = 0; i < body.frames.length; i++) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 return new ResponsePacket(request); | 1429 return new ResponsePacket(request); |
1430 }; | 1430 }; |
1431 | 1431 |
1432 | 1432 |
1433 DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request,
stopping) { | 1433 DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request,
stopping) { |
1434 var request; // Current request. | 1434 var request; // Current request. |
1435 var response; // Generated response. | 1435 var response; // Generated response. |
1436 try { | 1436 try { |
1437 try { | 1437 try { |
1438 // Convert the JSON string to an object. | 1438 // Convert the JSON string to an object. |
1439 request = %CompileString('(' + json_request + ')', false)(); | 1439 request = %CompileString('(' + json_request + ')', 0, false)(); |
1440 | 1440 |
1441 // Create an initial response. | 1441 // Create an initial response. |
1442 response = this.createResponse(request); | 1442 response = this.createResponse(request); |
1443 | 1443 |
1444 if (!request.type) { | 1444 if (!request.type) { |
1445 throw new Error('Type not specified'); | 1445 throw new Error('Type not specified'); |
1446 } | 1446 } |
1447 | 1447 |
1448 if (request.type != 'request') { | 1448 if (request.type != 'request') { |
1449 throw new Error("Illegal type '" + request.type + "' in request"); | 1449 throw new Error("Illegal type '" + request.type + "' in request"); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 response.body.push(script); | 1882 response.body.push(script); |
1883 } | 1883 } |
1884 } | 1884 } |
1885 }; | 1885 }; |
1886 | 1886 |
1887 | 1887 |
1888 // Check whether the JSON response indicate that the VM should be running. | 1888 // Check whether the JSON response indicate that the VM should be running. |
1889 DebugCommandProcessor.prototype.isRunning = function(json_response) { | 1889 DebugCommandProcessor.prototype.isRunning = function(json_response) { |
1890 try { | 1890 try { |
1891 // Convert the JSON string to an object. | 1891 // Convert the JSON string to an object. |
1892 response = %CompileString('(' + json_response + ')', false)(); | 1892 response = %CompileString('(' + json_response + ')', 0, false)(); |
1893 | 1893 |
1894 // Return whether VM should be running after this request. | 1894 // Return whether VM should be running after this request. |
1895 return response.running; | 1895 return response.running; |
1896 | 1896 |
1897 } catch (e) { | 1897 } catch (e) { |
1898 return false; | 1898 return false; |
1899 } | 1899 } |
1900 } | 1900 } |
1901 | 1901 |
1902 | 1902 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 json += NumberToJSON_(elem); | 2021 json += NumberToJSON_(elem); |
2022 } else if (IS_STRING(elem)) { | 2022 } else if (IS_STRING(elem)) { |
2023 json += StringToJSON_(elem); | 2023 json += StringToJSON_(elem); |
2024 } else { | 2024 } else { |
2025 json += elem; | 2025 json += elem; |
2026 } | 2026 } |
2027 } | 2027 } |
2028 json += ']'; | 2028 json += ']'; |
2029 return json; | 2029 return json; |
2030 }; | 2030 }; |
OLD | NEW |