| 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 | 4 |
| 5 (function (global, utils) { | 5 (function (global, utils) { |
| 6 "use strict"; | 6 "use strict"; |
| 7 | 7 |
| 8 // ---------------------------------------------------------------------------- | 8 // ---------------------------------------------------------------------------- |
| 9 // Imports | 9 // Imports |
| 10 | 10 |
| 11 var FrameMirror = global.FrameMirror; | 11 var FrameMirror = global.FrameMirror; |
| 12 var GlobalArray = global.Array; | 12 var GlobalArray = global.Array; |
| 13 var GlobalRegExp = global.RegExp; | 13 var GlobalRegExp = global.RegExp; |
| 14 var IsNaN = global.isNaN; | 14 var IsNaN = global.isNaN; |
| 15 var JSONParse = global.JSON.parse; | 15 var JSONParse = global.JSON.parse; |
| 16 var JSONStringify = global.JSON.stringify; | 16 var JSONStringify = global.JSON.stringify; |
| 17 var LookupMirror = global.LookupMirror; | 17 var LookupMirror = global.LookupMirror; |
| 18 var MakeMirror = global.MakeMirror; | 18 var MakeMirror = global.MakeMirror; |
| 19 var MakeMirrorSerializer = global.MakeMirrorSerializer; | 19 var MakeMirrorSerializer = global.MakeMirrorSerializer; |
| 20 var MathMin = global.Math.min; | 20 var MathMin = global.Math.min; |
| 21 var Mirror = global.Mirror; | 21 var Mirror = global.Mirror; |
| 22 var MirrorType; | 22 var MirrorType; |
| 23 var ParseInt = global.parseInt; | 23 var ParseInt = global.parseInt; |
| 24 var ToBoolean; | 24 var ToBoolean; |
| 25 var ToNumber; | |
| 26 var ToString; | |
| 27 var ValueMirror = global.ValueMirror; | 25 var ValueMirror = global.ValueMirror; |
| 28 | 26 |
| 29 utils.Import(function(from) { | 27 utils.Import(function(from) { |
| 30 MirrorType = from.MirrorType; | 28 MirrorType = from.MirrorType; |
| 31 ToBoolean = from.ToBoolean; | 29 ToBoolean = from.ToBoolean; |
| 32 ToNumber = from.ToNumber; | |
| 33 ToString = from.ToString; | |
| 34 }); | 30 }); |
| 35 | 31 |
| 36 //---------------------------------------------------------------------------- | 32 //---------------------------------------------------------------------------- |
| 37 | 33 |
| 38 // Default number of frames to include in the response to backtrace request. | 34 // Default number of frames to include in the response to backtrace request. |
| 39 var kDefaultBacktraceLength = 10; | 35 var kDefaultBacktraceLength = 10; |
| 40 | 36 |
| 41 var Debug = {}; | 37 var Debug = {}; |
| 42 | 38 |
| 43 // Regular expression to skip "crud" at the beginning of a source line which is | 39 // Regular expression to skip "crud" at the beginning of a source line which is |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 939 } |
| 944 | 940 |
| 945 function ExecutionState(break_id) { | 941 function ExecutionState(break_id) { |
| 946 this.break_id = break_id; | 942 this.break_id = break_id; |
| 947 this.selected_frame = 0; | 943 this.selected_frame = 0; |
| 948 } | 944 } |
| 949 | 945 |
| 950 ExecutionState.prototype.prepareStep = function(opt_action, opt_count, | 946 ExecutionState.prototype.prepareStep = function(opt_action, opt_count, |
| 951 opt_callframe) { | 947 opt_callframe) { |
| 952 var action = Debug.StepAction.StepIn; | 948 var action = Debug.StepAction.StepIn; |
| 953 if (!IS_UNDEFINED(opt_action)) action = ToNumber(opt_action); | 949 if (!IS_UNDEFINED(opt_action)) action = TO_NUMBER(opt_action); |
| 954 var count = opt_count ? ToNumber(opt_count) : 1; | 950 var count = opt_count ? TO_NUMBER(opt_count) : 1; |
| 955 var callFrameId = 0; | 951 var callFrameId = 0; |
| 956 if (!IS_UNDEFINED(opt_callframe)) { | 952 if (!IS_UNDEFINED(opt_callframe)) { |
| 957 callFrameId = opt_callframe.details_.frameId(); | 953 callFrameId = opt_callframe.details_.frameId(); |
| 958 } | 954 } |
| 959 | 955 |
| 960 return %PrepareStep(this.break_id, action, count, callFrameId); | 956 return %PrepareStep(this.break_id, action, count, callFrameId); |
| 961 }; | 957 }; |
| 962 | 958 |
| 963 ExecutionState.prototype.evaluateGlobal = function(source, disable_break, | 959 ExecutionState.prototype.evaluateGlobal = function(source, disable_break, |
| 964 opt_additional_context) { | 960 opt_additional_context) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 978 ExecutionState.prototype.frame = function(opt_index) { | 974 ExecutionState.prototype.frame = function(opt_index) { |
| 979 // If no index supplied return the selected frame. | 975 // If no index supplied return the selected frame. |
| 980 if (opt_index == null) opt_index = this.selected_frame; | 976 if (opt_index == null) opt_index = this.selected_frame; |
| 981 if (opt_index < 0 || opt_index >= this.frameCount()) { | 977 if (opt_index < 0 || opt_index >= this.frameCount()) { |
| 982 throw MakeTypeError(kDebuggerFrame); | 978 throw MakeTypeError(kDebuggerFrame); |
| 983 } | 979 } |
| 984 return new FrameMirror(this.break_id, opt_index); | 980 return new FrameMirror(this.break_id, opt_index); |
| 985 }; | 981 }; |
| 986 | 982 |
| 987 ExecutionState.prototype.setSelectedFrame = function(index) { | 983 ExecutionState.prototype.setSelectedFrame = function(index) { |
| 988 var i = ToNumber(index); | 984 var i = TO_NUMBER(index); |
| 989 if (i < 0 || i >= this.frameCount()) { | 985 if (i < 0 || i >= this.frameCount()) { |
| 990 throw MakeTypeError(kDebuggerFrame); | 986 throw MakeTypeError(kDebuggerFrame); |
| 991 } | 987 } |
| 992 this.selected_frame = i; | 988 this.selected_frame = i; |
| 993 }; | 989 }; |
| 994 | 990 |
| 995 ExecutionState.prototype.selectedFrame = function() { | 991 ExecutionState.prototype.selectedFrame = function() { |
| 996 return this.selected_frame; | 992 return this.selected_frame; |
| 997 }; | 993 }; |
| 998 | 994 |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 } else { | 1421 } else { |
| 1426 throw MakeError(kDebugger, | 1422 throw MakeError(kDebugger, |
| 1427 'Unknown command "' + request.command + '" in request'); | 1423 'Unknown command "' + request.command + '" in request'); |
| 1428 } | 1424 } |
| 1429 } catch (e) { | 1425 } catch (e) { |
| 1430 // If there is no response object created one (without command). | 1426 // If there is no response object created one (without command). |
| 1431 if (!response) { | 1427 if (!response) { |
| 1432 response = this.createResponse(); | 1428 response = this.createResponse(); |
| 1433 } | 1429 } |
| 1434 response.success = false; | 1430 response.success = false; |
| 1435 response.message = ToString(e); | 1431 response.message = TO_STRING(e); |
| 1436 } | 1432 } |
| 1437 | 1433 |
| 1438 // Return the response as a JSON encoded string. | 1434 // Return the response as a JSON encoded string. |
| 1439 try { | 1435 try { |
| 1440 if (!IS_UNDEFINED(response.running)) { | 1436 if (!IS_UNDEFINED(response.running)) { |
| 1441 // Response controls running state. | 1437 // Response controls running state. |
| 1442 this.running_ = response.running; | 1438 this.running_ = response.running; |
| 1443 } | 1439 } |
| 1444 response.running = this.running_; | 1440 response.running = this.running_; |
| 1445 return response.toJSONProtocol(); | 1441 return response.toJSONProtocol(); |
| 1446 } catch (e) { | 1442 } catch (e) { |
| 1447 // Failed to generate response - return generic error. | 1443 // Failed to generate response - return generic error. |
| 1448 return '{"seq":' + response.seq + ',' + | 1444 return '{"seq":' + response.seq + ',' + |
| 1449 '"request_seq":' + request.seq + ',' + | 1445 '"request_seq":' + request.seq + ',' + |
| 1450 '"type":"response",' + | 1446 '"type":"response",' + |
| 1451 '"success":false,' + | 1447 '"success":false,' + |
| 1452 '"message":"Internal error: ' + ToString(e) + '"}'; | 1448 '"message":"Internal error: ' + TO_STRING(e) + '"}'; |
| 1453 } | 1449 } |
| 1454 } catch (e) { | 1450 } catch (e) { |
| 1455 // Failed in one of the catch blocks above - most generic error. | 1451 // Failed in one of the catch blocks above - most generic error. |
| 1456 return '{"seq":0,"type":"response","success":false,"message":"Internal error
"}'; | 1452 return '{"seq":0,"type":"response","success":false,"message":"Internal error
"}'; |
| 1457 } | 1453 } |
| 1458 }; | 1454 }; |
| 1459 | 1455 |
| 1460 | 1456 |
| 1461 DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { | 1457 DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { |
| 1462 // Check for arguments for continue. | 1458 // Check for arguments for continue. |
| 1463 if (request.arguments) { | 1459 if (request.arguments) { |
| 1464 var count = 1; | 1460 var count = 1; |
| 1465 var action = Debug.StepAction.StepIn; | 1461 var action = Debug.StepAction.StepIn; |
| 1466 | 1462 |
| 1467 // Pull out arguments. | 1463 // Pull out arguments. |
| 1468 var stepaction = request.arguments.stepaction; | 1464 var stepaction = request.arguments.stepaction; |
| 1469 var stepcount = request.arguments.stepcount; | 1465 var stepcount = request.arguments.stepcount; |
| 1470 | 1466 |
| 1471 // Get the stepcount argument if any. | 1467 // Get the stepcount argument if any. |
| 1472 if (stepcount) { | 1468 if (stepcount) { |
| 1473 count = ToNumber(stepcount); | 1469 count = TO_NUMBER(stepcount); |
| 1474 if (count < 0) { | 1470 if (count < 0) { |
| 1475 throw MakeError(kDebugger, | 1471 throw MakeError(kDebugger, |
| 1476 'Invalid stepcount argument "' + stepcount + '".'); | 1472 'Invalid stepcount argument "' + stepcount + '".'); |
| 1477 } | 1473 } |
| 1478 } | 1474 } |
| 1479 | 1475 |
| 1480 // Get the stepaction argument. | 1476 // Get the stepaction argument. |
| 1481 if (stepaction) { | 1477 if (stepaction) { |
| 1482 if (stepaction == 'in') { | 1478 if (stepaction == 'in') { |
| 1483 action = Debug.StepAction.StepIn; | 1479 action = Debug.StepAction.StepIn; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 // Handle function break point. | 1534 // Handle function break point. |
| 1539 if (!IS_STRING(target)) { | 1535 if (!IS_STRING(target)) { |
| 1540 response.failed('Argument "target" is not a string value'); | 1536 response.failed('Argument "target" is not a string value'); |
| 1541 return; | 1537 return; |
| 1542 } | 1538 } |
| 1543 var f; | 1539 var f; |
| 1544 try { | 1540 try { |
| 1545 // Find the function through a global evaluate. | 1541 // Find the function through a global evaluate. |
| 1546 f = this.exec_state_.evaluateGlobal(target).value(); | 1542 f = this.exec_state_.evaluateGlobal(target).value(); |
| 1547 } catch (e) { | 1543 } catch (e) { |
| 1548 response.failed('Error: "' + ToString(e) + | 1544 response.failed('Error: "' + TO_STRING(e) + |
| 1549 '" evaluating "' + target + '"'); | 1545 '" evaluating "' + target + '"'); |
| 1550 return; | 1546 return; |
| 1551 } | 1547 } |
| 1552 if (!IS_FUNCTION(f)) { | 1548 if (!IS_FUNCTION(f)) { |
| 1553 response.failed('"' + target + '" does not evaluate to a function'); | 1549 response.failed('"' + target + '" does not evaluate to a function'); |
| 1554 return; | 1550 return; |
| 1555 } | 1551 } |
| 1556 | 1552 |
| 1557 // Set function break point. | 1553 // Set function break point. |
| 1558 break_point_number = Debug.setBreakPoint(f, line, column, condition); | 1554 break_point_number = Debug.setBreakPoint(f, line, column, condition); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 | 1623 |
| 1628 DebugCommandProcessor.prototype.changeBreakPointRequest_ = function( | 1624 DebugCommandProcessor.prototype.changeBreakPointRequest_ = function( |
| 1629 request, response) { | 1625 request, response) { |
| 1630 // Check for legal request. | 1626 // Check for legal request. |
| 1631 if (!request.arguments) { | 1627 if (!request.arguments) { |
| 1632 response.failed('Missing arguments'); | 1628 response.failed('Missing arguments'); |
| 1633 return; | 1629 return; |
| 1634 } | 1630 } |
| 1635 | 1631 |
| 1636 // Pull out arguments. | 1632 // Pull out arguments. |
| 1637 var break_point = ToNumber(request.arguments.breakpoint); | 1633 var break_point = TO_NUMBER(request.arguments.breakpoint); |
| 1638 var enabled = request.arguments.enabled; | 1634 var enabled = request.arguments.enabled; |
| 1639 var condition = request.arguments.condition; | 1635 var condition = request.arguments.condition; |
| 1640 var ignoreCount = request.arguments.ignoreCount; | 1636 var ignoreCount = request.arguments.ignoreCount; |
| 1641 | 1637 |
| 1642 // Check for legal arguments. | 1638 // Check for legal arguments. |
| 1643 if (!break_point) { | 1639 if (!break_point) { |
| 1644 response.failed('Missing argument "breakpoint"'); | 1640 response.failed('Missing argument "breakpoint"'); |
| 1645 return; | 1641 return; |
| 1646 } | 1642 } |
| 1647 | 1643 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 | 1699 |
| 1704 DebugCommandProcessor.prototype.clearBreakPointRequest_ = function( | 1700 DebugCommandProcessor.prototype.clearBreakPointRequest_ = function( |
| 1705 request, response) { | 1701 request, response) { |
| 1706 // Check for legal request. | 1702 // Check for legal request. |
| 1707 if (!request.arguments) { | 1703 if (!request.arguments) { |
| 1708 response.failed('Missing arguments'); | 1704 response.failed('Missing arguments'); |
| 1709 return; | 1705 return; |
| 1710 } | 1706 } |
| 1711 | 1707 |
| 1712 // Pull out arguments. | 1708 // Pull out arguments. |
| 1713 var break_point = ToNumber(request.arguments.breakpoint); | 1709 var break_point = TO_NUMBER(request.arguments.breakpoint); |
| 1714 | 1710 |
| 1715 // Check for legal arguments. | 1711 // Check for legal arguments. |
| 1716 if (!break_point) { | 1712 if (!break_point) { |
| 1717 response.failed('Missing argument "breakpoint"'); | 1713 response.failed('Missing argument "breakpoint"'); |
| 1718 return; | 1714 return; |
| 1719 } | 1715 } |
| 1720 | 1716 |
| 1721 // Clear break point. | 1717 // Clear break point. |
| 1722 Debug.clearBreakPoint(break_point); | 1718 Debug.clearBreakPoint(break_point); |
| 1723 | 1719 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 }; | 1957 }; |
| 1962 | 1958 |
| 1963 | 1959 |
| 1964 DebugCommandProcessor.prototype.scopeRequest_ = function(request, response) { | 1960 DebugCommandProcessor.prototype.scopeRequest_ = function(request, response) { |
| 1965 // Get the frame or function for which the scope is requested. | 1961 // Get the frame or function for which the scope is requested. |
| 1966 var scope_holder = this.resolveScopeHolder_(request.arguments); | 1962 var scope_holder = this.resolveScopeHolder_(request.arguments); |
| 1967 | 1963 |
| 1968 // With no scope argument just return top scope. | 1964 // With no scope argument just return top scope. |
| 1969 var scope_index = 0; | 1965 var scope_index = 0; |
| 1970 if (request.arguments && !IS_UNDEFINED(request.arguments.number)) { | 1966 if (request.arguments && !IS_UNDEFINED(request.arguments.number)) { |
| 1971 scope_index = ToNumber(request.arguments.number); | 1967 scope_index = TO_NUMBER(request.arguments.number); |
| 1972 if (scope_index < 0 || scope_holder.scopeCount() <= scope_index) { | 1968 if (scope_index < 0 || scope_holder.scopeCount() <= scope_index) { |
| 1973 return response.failed('Invalid scope number'); | 1969 return response.failed('Invalid scope number'); |
| 1974 } | 1970 } |
| 1975 } | 1971 } |
| 1976 | 1972 |
| 1977 response.body = scope_holder.scope(scope_index); | 1973 response.body = scope_holder.scope(scope_index); |
| 1978 }; | 1974 }; |
| 1979 | 1975 |
| 1980 | 1976 |
| 1981 // Reads value from protocol description. Description may be in form of type | 1977 // Reads value from protocol description. Description may be in form of type |
| 1982 // (for singletons), raw value (primitive types supported in JSON), | 1978 // (for singletons), raw value (primitive types supported in JSON), |
| 1983 // string value description plus type (for primitive values) or handle id. | 1979 // string value description plus type (for primitive values) or handle id. |
| 1984 // Returns raw value or throws exception. | 1980 // Returns raw value or throws exception. |
| 1985 DebugCommandProcessor.resolveValue_ = function(value_description) { | 1981 DebugCommandProcessor.resolveValue_ = function(value_description) { |
| 1986 if ("handle" in value_description) { | 1982 if ("handle" in value_description) { |
| 1987 var value_mirror = LookupMirror(value_description.handle); | 1983 var value_mirror = LookupMirror(value_description.handle); |
| 1988 if (!value_mirror) { | 1984 if (!value_mirror) { |
| 1989 throw MakeError(kDebugger, "Failed to resolve value by handle, ' #" + | 1985 throw MakeError(kDebugger, "Failed to resolve value by handle, ' #" + |
| 1990 value_description.handle + "# not found"); | 1986 value_description.handle + "# not found"); |
| 1991 } | 1987 } |
| 1992 return value_mirror.value(); | 1988 return value_mirror.value(); |
| 1993 } else if ("stringDescription" in value_description) { | 1989 } else if ("stringDescription" in value_description) { |
| 1994 if (value_description.type == MirrorType.BOOLEAN_TYPE) { | 1990 if (value_description.type == MirrorType.BOOLEAN_TYPE) { |
| 1995 return ToBoolean(value_description.stringDescription); | 1991 return ToBoolean(value_description.stringDescription); |
| 1996 } else if (value_description.type == MirrorType.NUMBER_TYPE) { | 1992 } else if (value_description.type == MirrorType.NUMBER_TYPE) { |
| 1997 return ToNumber(value_description.stringDescription); | 1993 return TO_NUMBER(value_description.stringDescription); |
| 1998 } if (value_description.type == MirrorType.STRING_TYPE) { | 1994 } if (value_description.type == MirrorType.STRING_TYPE) { |
| 1999 return ToString(value_description.stringDescription); | 1995 return TO_STRING(value_description.stringDescription); |
| 2000 } else { | 1996 } else { |
| 2001 throw MakeError(kDebugger, "Unknown type"); | 1997 throw MakeError(kDebugger, "Unknown type"); |
| 2002 } | 1998 } |
| 2003 } else if ("value" in value_description) { | 1999 } else if ("value" in value_description) { |
| 2004 return value_description.value; | 2000 return value_description.value; |
| 2005 } else if (value_description.type == MirrorType.UNDEFINED_TYPE) { | 2001 } else if (value_description.type == MirrorType.UNDEFINED_TYPE) { |
| 2006 return UNDEFINED; | 2002 return UNDEFINED; |
| 2007 } else if (value_description.type == MirrorType.NULL_TYPE) { | 2003 } else if (value_description.type == MirrorType.NULL_TYPE) { |
| 2008 return null; | 2004 return null; |
| 2009 } else { | 2005 } else { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2025 var variable_name = request.arguments.name; | 2021 var variable_name = request.arguments.name; |
| 2026 | 2022 |
| 2027 var scope_description = request.arguments.scope; | 2023 var scope_description = request.arguments.scope; |
| 2028 | 2024 |
| 2029 // Get the frame or function for which the scope is requested. | 2025 // Get the frame or function for which the scope is requested. |
| 2030 var scope_holder = this.resolveScopeHolder_(scope_description); | 2026 var scope_holder = this.resolveScopeHolder_(scope_description); |
| 2031 | 2027 |
| 2032 if (IS_UNDEFINED(scope_description.number)) { | 2028 if (IS_UNDEFINED(scope_description.number)) { |
| 2033 response.failed('Missing scope number'); | 2029 response.failed('Missing scope number'); |
| 2034 } | 2030 } |
| 2035 var scope_index = ToNumber(scope_description.number); | 2031 var scope_index = TO_NUMBER(scope_description.number); |
| 2036 | 2032 |
| 2037 var scope = scope_holder.scope(scope_index); | 2033 var scope = scope_holder.scope(scope_index); |
| 2038 | 2034 |
| 2039 var new_value = | 2035 var new_value = |
| 2040 DebugCommandProcessor.resolveValue_(request.arguments.newValue); | 2036 DebugCommandProcessor.resolveValue_(request.arguments.newValue); |
| 2041 | 2037 |
| 2042 scope.setVariableValue(variable_name, new_value); | 2038 scope.setVariableValue(variable_name, new_value); |
| 2043 | 2039 |
| 2044 var new_value_mirror = MakeMirror(new_value); | 2040 var new_value_mirror = MakeMirror(new_value); |
| 2045 | 2041 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2057 // Pull out arguments. | 2053 // Pull out arguments. |
| 2058 var expression = request.arguments.expression; | 2054 var expression = request.arguments.expression; |
| 2059 var frame = request.arguments.frame; | 2055 var frame = request.arguments.frame; |
| 2060 var global = request.arguments.global; | 2056 var global = request.arguments.global; |
| 2061 var disable_break = request.arguments.disable_break; | 2057 var disable_break = request.arguments.disable_break; |
| 2062 var additional_context = request.arguments.additional_context; | 2058 var additional_context = request.arguments.additional_context; |
| 2063 | 2059 |
| 2064 // The expression argument could be an integer so we convert it to a | 2060 // The expression argument could be an integer so we convert it to a |
| 2065 // string. | 2061 // string. |
| 2066 try { | 2062 try { |
| 2067 expression = ToString(expression); | 2063 expression = TO_STRING(expression); |
| 2068 } catch(e) { | 2064 } catch(e) { |
| 2069 return response.failed('Failed to convert expression argument to string'); | 2065 return response.failed('Failed to convert expression argument to string'); |
| 2070 } | 2066 } |
| 2071 | 2067 |
| 2072 // Check for legal arguments. | 2068 // Check for legal arguments. |
| 2073 if (!IS_UNDEFINED(frame) && global) { | 2069 if (!IS_UNDEFINED(frame) && global) { |
| 2074 return response.failed('Arguments "frame" and "global" are exclusive'); | 2070 return response.failed('Arguments "frame" and "global" are exclusive'); |
| 2075 } | 2071 } |
| 2076 | 2072 |
| 2077 var additional_context_object; | 2073 var additional_context_object; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2103 disable_break = true; | 2099 disable_break = true; |
| 2104 } | 2100 } |
| 2105 | 2101 |
| 2106 // No frames no evaluate in frame. | 2102 // No frames no evaluate in frame. |
| 2107 if (this.exec_state_.frameCount() == 0) { | 2103 if (this.exec_state_.frameCount() == 0) { |
| 2108 return response.failed('No frames'); | 2104 return response.failed('No frames'); |
| 2109 } | 2105 } |
| 2110 | 2106 |
| 2111 // Check whether a frame was specified. | 2107 // Check whether a frame was specified. |
| 2112 if (!IS_UNDEFINED(frame)) { | 2108 if (!IS_UNDEFINED(frame)) { |
| 2113 var frame_number = ToNumber(frame); | 2109 var frame_number = TO_NUMBER(frame); |
| 2114 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { | 2110 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
| 2115 return response.failed('Invalid frame "' + frame + '"'); | 2111 return response.failed('Invalid frame "' + frame + '"'); |
| 2116 } | 2112 } |
| 2117 // Evaluate in the specified frame. | 2113 // Evaluate in the specified frame. |
| 2118 response.body = this.exec_state_.frame(frame_number).evaluate( | 2114 response.body = this.exec_state_.frame(frame_number).evaluate( |
| 2119 expression, ToBoolean(disable_break), additional_context_object); | 2115 expression, ToBoolean(disable_break), additional_context_object); |
| 2120 return; | 2116 return; |
| 2121 } else { | 2117 } else { |
| 2122 // Evaluate in the selected frame. | 2118 // Evaluate in the selected frame. |
| 2123 response.body = this.exec_state_.frame().evaluate( | 2119 response.body = this.exec_state_.frame().evaluate( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 | 2199 |
| 2204 var from_line; | 2200 var from_line; |
| 2205 var to_line; | 2201 var to_line; |
| 2206 var frame = this.exec_state_.frame(); | 2202 var frame = this.exec_state_.frame(); |
| 2207 if (request.arguments) { | 2203 if (request.arguments) { |
| 2208 // Pull out arguments. | 2204 // Pull out arguments. |
| 2209 from_line = request.arguments.fromLine; | 2205 from_line = request.arguments.fromLine; |
| 2210 to_line = request.arguments.toLine; | 2206 to_line = request.arguments.toLine; |
| 2211 | 2207 |
| 2212 if (!IS_UNDEFINED(request.arguments.frame)) { | 2208 if (!IS_UNDEFINED(request.arguments.frame)) { |
| 2213 var frame_number = ToNumber(request.arguments.frame); | 2209 var frame_number = TO_NUMBER(request.arguments.frame); |
| 2214 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { | 2210 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
| 2215 return response.failed('Invalid frame "' + frame + '"'); | 2211 return response.failed('Invalid frame "' + frame + '"'); |
| 2216 } | 2212 } |
| 2217 frame = this.exec_state_.frame(frame_number); | 2213 frame = this.exec_state_.frame(frame_number); |
| 2218 } | 2214 } |
| 2219 } | 2215 } |
| 2220 | 2216 |
| 2221 // Get the script selected. | 2217 // Get the script selected. |
| 2222 var script = frame.func().script(); | 2218 var script = frame.func().script(); |
| 2223 if (!script) { | 2219 if (!script) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2239 }; | 2235 }; |
| 2240 | 2236 |
| 2241 | 2237 |
| 2242 DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { | 2238 DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) { |
| 2243 var types = ScriptTypeFlag(Debug.ScriptType.Normal); | 2239 var types = ScriptTypeFlag(Debug.ScriptType.Normal); |
| 2244 var includeSource = false; | 2240 var includeSource = false; |
| 2245 var idsToInclude = null; | 2241 var idsToInclude = null; |
| 2246 if (request.arguments) { | 2242 if (request.arguments) { |
| 2247 // Pull out arguments. | 2243 // Pull out arguments. |
| 2248 if (!IS_UNDEFINED(request.arguments.types)) { | 2244 if (!IS_UNDEFINED(request.arguments.types)) { |
| 2249 types = ToNumber(request.arguments.types); | 2245 types = TO_NUMBER(request.arguments.types); |
| 2250 if (IsNaN(types) || types < 0) { | 2246 if (IsNaN(types) || types < 0) { |
| 2251 return response.failed('Invalid types "' + | 2247 return response.failed('Invalid types "' + |
| 2252 request.arguments.types + '"'); | 2248 request.arguments.types + '"'); |
| 2253 } | 2249 } |
| 2254 } | 2250 } |
| 2255 | 2251 |
| 2256 if (!IS_UNDEFINED(request.arguments.includeSource)) { | 2252 if (!IS_UNDEFINED(request.arguments.includeSource)) { |
| 2257 includeSource = ToBoolean(request.arguments.includeSource); | 2253 includeSource = ToBoolean(request.arguments.includeSource); |
| 2258 response.setOption('includeSource', includeSource); | 2254 response.setOption('includeSource', includeSource); |
| 2259 } | 2255 } |
| 2260 | 2256 |
| 2261 if (IS_ARRAY(request.arguments.ids)) { | 2257 if (IS_ARRAY(request.arguments.ids)) { |
| 2262 idsToInclude = {}; | 2258 idsToInclude = {}; |
| 2263 var ids = request.arguments.ids; | 2259 var ids = request.arguments.ids; |
| 2264 for (var i = 0; i < ids.length; i++) { | 2260 for (var i = 0; i < ids.length; i++) { |
| 2265 idsToInclude[ids[i]] = true; | 2261 idsToInclude[ids[i]] = true; |
| 2266 } | 2262 } |
| 2267 } | 2263 } |
| 2268 | 2264 |
| 2269 var filterStr = null; | 2265 var filterStr = null; |
| 2270 var filterNum = null; | 2266 var filterNum = null; |
| 2271 if (!IS_UNDEFINED(request.arguments.filter)) { | 2267 if (!IS_UNDEFINED(request.arguments.filter)) { |
| 2272 var num = ToNumber(request.arguments.filter); | 2268 var num = TO_NUMBER(request.arguments.filter); |
| 2273 if (!IsNaN(num)) { | 2269 if (!IsNaN(num)) { |
| 2274 filterNum = num; | 2270 filterNum = num; |
| 2275 } | 2271 } |
| 2276 filterStr = request.arguments.filter; | 2272 filterStr = request.arguments.filter; |
| 2277 } | 2273 } |
| 2278 } | 2274 } |
| 2279 | 2275 |
| 2280 // Collect all scripts in the heap. | 2276 // Collect all scripts in the heap. |
| 2281 var scripts = %DebugGetLoadedScripts(); | 2277 var scripts = %DebugGetLoadedScripts(); |
| 2282 | 2278 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2398 var frame = request.arguments.frame; | 2394 var frame = request.arguments.frame; |
| 2399 | 2395 |
| 2400 // No frames to evaluate in frame. | 2396 // No frames to evaluate in frame. |
| 2401 if (this.exec_state_.frameCount() == 0) { | 2397 if (this.exec_state_.frameCount() == 0) { |
| 2402 return response.failed('No frames'); | 2398 return response.failed('No frames'); |
| 2403 } | 2399 } |
| 2404 | 2400 |
| 2405 var frame_mirror; | 2401 var frame_mirror; |
| 2406 // Check whether a frame was specified. | 2402 // Check whether a frame was specified. |
| 2407 if (!IS_UNDEFINED(frame)) { | 2403 if (!IS_UNDEFINED(frame)) { |
| 2408 var frame_number = ToNumber(frame); | 2404 var frame_number = TO_NUMBER(frame); |
| 2409 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { | 2405 if (frame_number < 0 || frame_number >= this.exec_state_.frameCount()) { |
| 2410 return response.failed('Invalid frame "' + frame + '"'); | 2406 return response.failed('Invalid frame "' + frame + '"'); |
| 2411 } | 2407 } |
| 2412 // Restart specified frame. | 2408 // Restart specified frame. |
| 2413 frame_mirror = this.exec_state_.frame(frame_number); | 2409 frame_mirror = this.exec_state_.frame(frame_number); |
| 2414 } else { | 2410 } else { |
| 2415 // Restart selected frame. | 2411 // Restart selected frame. |
| 2416 frame_mirror = this.exec_state_.frame(); | 2412 frame_mirror = this.exec_state_.frame(); |
| 2417 } | 2413 } |
| 2418 | 2414 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 "IsBreakPointTriggered", IsBreakPointTriggered, | 2616 "IsBreakPointTriggered", IsBreakPointTriggered, |
| 2621 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, | 2617 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, |
| 2622 ]); | 2618 ]); |
| 2623 | 2619 |
| 2624 // Export to liveedit.js | 2620 // Export to liveedit.js |
| 2625 utils.Export(function(to) { | 2621 utils.Export(function(to) { |
| 2626 to.GetScriptBreakPoints = GetScriptBreakPoints; | 2622 to.GetScriptBreakPoints = GetScriptBreakPoints; |
| 2627 }); | 2623 }); |
| 2628 | 2624 |
| 2629 }) | 2625 }) |
| OLD | NEW |