| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 "use strict"; | 4 "use strict"; |
| 5 | 5 |
| 6 // Default number of frames to include in the response to backtrace request. | 6 // Default number of frames to include in the response to backtrace request. |
| 7 var kDefaultBacktraceLength = 10; | 7 var kDefaultBacktraceLength = 10; |
| 8 | 8 |
| 9 var Debug = {}; | 9 var Debug = {}; |
| 10 | 10 |
| (...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 } | 1880 } |
| 1881 response.body = this.exec_state_.frame(); | 1881 response.body = this.exec_state_.frame(); |
| 1882 }; | 1882 }; |
| 1883 | 1883 |
| 1884 | 1884 |
| 1885 DebugCommandProcessor.prototype.resolveFrameFromScopeDescription_ = | 1885 DebugCommandProcessor.prototype.resolveFrameFromScopeDescription_ = |
| 1886 function(scope_description) { | 1886 function(scope_description) { |
| 1887 // Get the frame for which the scope or scopes are requested. | 1887 // Get the frame for which the scope or scopes are requested. |
| 1888 // With no frameNumber argument use the currently selected frame. | 1888 // With no frameNumber argument use the currently selected frame. |
| 1889 if (scope_description && !IS_UNDEFINED(scope_description.frameNumber)) { | 1889 if (scope_description && !IS_UNDEFINED(scope_description.frameNumber)) { |
| 1890 frame_index = scope_description.frameNumber; | 1890 var frame_index = scope_description.frameNumber; |
| 1891 if (frame_index < 0 || this.exec_state_.frameCount() <= frame_index) { | 1891 if (frame_index < 0 || this.exec_state_.frameCount() <= frame_index) { |
| 1892 throw new Error('Invalid frame number'); | 1892 throw new Error('Invalid frame number'); |
| 1893 } | 1893 } |
| 1894 return this.exec_state_.frame(frame_index); | 1894 return this.exec_state_.frame(frame_index); |
| 1895 } else { | 1895 } else { |
| 1896 return this.exec_state_.frame(); | 1896 return this.exec_state_.frame(); |
| 1897 } | 1897 } |
| 1898 }; | 1898 }; |
| 1899 | 1899 |
| 1900 | 1900 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1965 | 1965 |
| 1966 // Reads value from protocol description. Description may be in form of type | 1966 // Reads value from protocol description. Description may be in form of type |
| 1967 // (for singletons), raw value (primitive types supported in JSON), | 1967 // (for singletons), raw value (primitive types supported in JSON), |
| 1968 // string value description plus type (for primitive values) or handle id. | 1968 // string value description plus type (for primitive values) or handle id. |
| 1969 // Returns raw value or throws exception. | 1969 // Returns raw value or throws exception. |
| 1970 DebugCommandProcessor.resolveValue_ = function(value_description) { | 1970 DebugCommandProcessor.resolveValue_ = function(value_description) { |
| 1971 if ("handle" in value_description) { | 1971 if ("handle" in value_description) { |
| 1972 var value_mirror = LookupMirror(value_description.handle); | 1972 var value_mirror = LookupMirror(value_description.handle); |
| 1973 if (!value_mirror) { | 1973 if (!value_mirror) { |
| 1974 throw new Error("Failed to resolve value by handle, ' #" + | 1974 throw new Error("Failed to resolve value by handle, ' #" + |
| 1975 mapping.handle + "# not found"); | 1975 value_description.handle + "# not found"); |
| 1976 } | 1976 } |
| 1977 return value_mirror.value(); | 1977 return value_mirror.value(); |
| 1978 } else if ("stringDescription" in value_description) { | 1978 } else if ("stringDescription" in value_description) { |
| 1979 if (value_description.type == BOOLEAN_TYPE) { | 1979 if (value_description.type == BOOLEAN_TYPE) { |
| 1980 return Boolean(value_description.stringDescription); | 1980 return Boolean(value_description.stringDescription); |
| 1981 } else if (value_description.type == NUMBER_TYPE) { | 1981 } else if (value_description.type == NUMBER_TYPE) { |
| 1982 return Number(value_description.stringDescription); | 1982 return Number(value_description.stringDescription); |
| 1983 } if (value_description.type == STRING_TYPE) { | 1983 } if (value_description.type == STRING_TYPE) { |
| 1984 return String(value_description.stringDescription); | 1984 return String(value_description.stringDescription); |
| 1985 } else { | 1985 } else { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 // Pull out arguments. | 2120 // Pull out arguments. |
| 2121 var handles = request.arguments.handles; | 2121 var handles = request.arguments.handles; |
| 2122 | 2122 |
| 2123 // Check for legal arguments. | 2123 // Check for legal arguments. |
| 2124 if (IS_UNDEFINED(handles)) { | 2124 if (IS_UNDEFINED(handles)) { |
| 2125 return response.failed('Argument "handles" missing'); | 2125 return response.failed('Argument "handles" missing'); |
| 2126 } | 2126 } |
| 2127 | 2127 |
| 2128 // Set 'includeSource' option for script lookup. | 2128 // Set 'includeSource' option for script lookup. |
| 2129 if (!IS_UNDEFINED(request.arguments.includeSource)) { | 2129 if (!IS_UNDEFINED(request.arguments.includeSource)) { |
| 2130 includeSource = %ToBoolean(request.arguments.includeSource); | 2130 var includeSource = %ToBoolean(request.arguments.includeSource); |
| 2131 response.setOption('includeSource', includeSource); | 2131 response.setOption('includeSource', includeSource); |
| 2132 } | 2132 } |
| 2133 | 2133 |
| 2134 // Lookup handles. | 2134 // Lookup handles. |
| 2135 var mirrors = {}; | 2135 var mirrors = {}; |
| 2136 for (var i = 0; i < handles.length; i++) { | 2136 for (var i = 0; i < handles.length; i++) { |
| 2137 var handle = handles[i]; | 2137 var handle = handles[i]; |
| 2138 var mirror = LookupMirror(handle); | 2138 var mirror = LookupMirror(handle); |
| 2139 if (!mirror) { | 2139 if (!mirror) { |
| 2140 return response.failed('Object #' + handle + '# not found'); | 2140 return response.failed('Object #' + handle + '# not found'); |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2581 | 2581 |
| 2582 default: | 2582 default: |
| 2583 json = null; | 2583 json = null; |
| 2584 } | 2584 } |
| 2585 return json; | 2585 return json; |
| 2586 } | 2586 } |
| 2587 | 2587 |
| 2588 Debug.TestApi = { | 2588 Debug.TestApi = { |
| 2589 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2589 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
| 2590 }; | 2590 }; |
| OLD | NEW |