| 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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 }; | 890 }; |
| 891 | 891 |
| 892 ExecutionState.prototype.frame = function(opt_index) { | 892 ExecutionState.prototype.frame = function(opt_index) { |
| 893 // If no index supplied return the selected frame. | 893 // If no index supplied return the selected frame. |
| 894 if (opt_index == null) opt_index = this.selected_frame; | 894 if (opt_index == null) opt_index = this.selected_frame; |
| 895 if (opt_index < 0 || opt_index >= this.frameCount()) | 895 if (opt_index < 0 || opt_index >= this.frameCount()) |
| 896 throw new Error('Illegal frame index.'); | 896 throw new Error('Illegal frame index.'); |
| 897 return new FrameMirror(this.break_id, opt_index); | 897 return new FrameMirror(this.break_id, opt_index); |
| 898 }; | 898 }; |
| 899 | 899 |
| 900 ExecutionState.prototype.cframesValue = function(opt_from_index, opt_to_index) { | |
| 901 return %GetCFrames(this.break_id); | |
| 902 }; | |
| 903 | |
| 904 ExecutionState.prototype.setSelectedFrame = function(index) { | 900 ExecutionState.prototype.setSelectedFrame = function(index) { |
| 905 var i = %ToNumber(index); | 901 var i = %ToNumber(index); |
| 906 if (i < 0 || i >= this.frameCount()) throw new Error('Illegal frame index.'); | 902 if (i < 0 || i >= this.frameCount()) throw new Error('Illegal frame index.'); |
| 907 this.selected_frame = i; | 903 this.selected_frame = i; |
| 908 }; | 904 }; |
| 909 | 905 |
| 910 ExecutionState.prototype.selectedFrame = function() { | 906 ExecutionState.prototype.selectedFrame = function() { |
| 911 return this.selected_frame; | 907 return this.selected_frame; |
| 912 }; | 908 }; |
| 913 | 909 |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 } | 1740 } |
| 1745 response.body = { | 1741 response.body = { |
| 1746 fromFrame: from_index, | 1742 fromFrame: from_index, |
| 1747 toFrame: to_index, | 1743 toFrame: to_index, |
| 1748 totalFrames: total_frames, | 1744 totalFrames: total_frames, |
| 1749 frames: frames | 1745 frames: frames |
| 1750 } | 1746 } |
| 1751 }; | 1747 }; |
| 1752 | 1748 |
| 1753 | 1749 |
| 1754 DebugCommandProcessor.prototype.backtracec = function(cmd, args) { | |
| 1755 return this.exec_state_.cframesValue(); | |
| 1756 }; | |
| 1757 | |
| 1758 | |
| 1759 DebugCommandProcessor.prototype.frameRequest_ = function(request, response) { | 1750 DebugCommandProcessor.prototype.frameRequest_ = function(request, response) { |
| 1760 // No frames no source. | 1751 // No frames no source. |
| 1761 if (this.exec_state_.frameCount() == 0) { | 1752 if (this.exec_state_.frameCount() == 0) { |
| 1762 return response.failed('No frames'); | 1753 return response.failed('No frames'); |
| 1763 } | 1754 } |
| 1764 | 1755 |
| 1765 // With no arguments just keep the selected frame. | 1756 // With no arguments just keep the selected frame. |
| 1766 if (request.arguments) { | 1757 if (request.arguments) { |
| 1767 var index = request.arguments.number; | 1758 var index = request.arguments.number; |
| 1768 if (index < 0 || this.exec_state_.frameCount() <= index) { | 1759 if (index < 0 || this.exec_state_.frameCount() <= index) { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 function NumberToHex8Str(n) { | 2189 function NumberToHex8Str(n) { |
| 2199 var r = ""; | 2190 var r = ""; |
| 2200 for (var i = 0; i < 8; ++i) { | 2191 for (var i = 0; i < 8; ++i) { |
| 2201 var c = hexCharArray[n & 0x0F]; // hexCharArray is defined in uri.js | 2192 var c = hexCharArray[n & 0x0F]; // hexCharArray is defined in uri.js |
| 2202 r = c + r; | 2193 r = c + r; |
| 2203 n = n >>> 4; | 2194 n = n >>> 4; |
| 2204 } | 2195 } |
| 2205 return r; | 2196 return r; |
| 2206 }; | 2197 }; |
| 2207 | 2198 |
| 2208 DebugCommandProcessor.prototype.formatCFrames = function(cframes_value) { | |
| 2209 var result = ""; | |
| 2210 if (cframes_value == null || cframes_value.length == 0) { | |
| 2211 result += "(stack empty)"; | |
| 2212 } else { | |
| 2213 for (var i = 0; i < cframes_value.length; ++i) { | |
| 2214 if (i != 0) result += "\n"; | |
| 2215 result += this.formatCFrame(cframes_value[i]); | |
| 2216 } | |
| 2217 } | |
| 2218 return result; | |
| 2219 }; | |
| 2220 | |
| 2221 | |
| 2222 DebugCommandProcessor.prototype.formatCFrame = function(cframe_value) { | |
| 2223 var result = ""; | |
| 2224 result += "0x" + NumberToHex8Str(cframe_value.address); | |
| 2225 if (!IS_UNDEFINED(cframe_value.text)) { | |
| 2226 result += " " + cframe_value.text; | |
| 2227 } | |
| 2228 return result; | |
| 2229 } | |
| 2230 | |
| 2231 | 2199 |
| 2232 /** | 2200 /** |
| 2233 * Convert an Object to its debugger protocol representation. The representation | 2201 * Convert an Object to its debugger protocol representation. The representation |
| 2234 * may be serilized to a JSON object using JSON.stringify(). | 2202 * may be serilized to a JSON object using JSON.stringify(). |
| 2235 * This implementation simply runs through all string property names, converts | 2203 * This implementation simply runs through all string property names, converts |
| 2236 * each property value to a protocol value and adds the property to the result | 2204 * each property value to a protocol value and adds the property to the result |
| 2237 * object. For type "object" the function will be called recursively. Note that | 2205 * object. For type "object" the function will be called recursively. Note that |
| 2238 * circular structures will cause infinite recursion. | 2206 * circular structures will cause infinite recursion. |
| 2239 * @param {Object} object The object to format as protocol object. | 2207 * @param {Object} object The object to format as protocol object. |
| 2240 * @param {MirrorSerializer} mirror_serializer The serializer to use if any | 2208 * @param {MirrorSerializer} mirror_serializer The serializer to use if any |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2302 case 'string': | 2270 case 'string': |
| 2303 case 'number': | 2271 case 'number': |
| 2304 json = value; | 2272 json = value; |
| 2305 break | 2273 break |
| 2306 | 2274 |
| 2307 default: | 2275 default: |
| 2308 json = null; | 2276 json = null; |
| 2309 } | 2277 } |
| 2310 return json; | 2278 return json; |
| 2311 } | 2279 } |
| OLD | NEW |