| 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 |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 | 936 |
| 937 function MakeExecutionState(break_id) { | 937 function MakeExecutionState(break_id) { |
| 938 return new ExecutionState(break_id); | 938 return new ExecutionState(break_id); |
| 939 } | 939 } |
| 940 | 940 |
| 941 function ExecutionState(break_id) { | 941 function ExecutionState(break_id) { |
| 942 this.break_id = break_id; | 942 this.break_id = break_id; |
| 943 this.selected_frame = 0; | 943 this.selected_frame = 0; |
| 944 } | 944 } |
| 945 | 945 |
| 946 ExecutionState.prototype.prepareStep = function(opt_action, opt_count) { | 946 ExecutionState.prototype.prepareStep = function(action) { |
| 947 var action = Debug.StepAction.StepIn; | 947 if (action === Debug.StepAction.StepIn || |
| 948 if (!IS_UNDEFINED(opt_action)) action = TO_NUMBER(opt_action); | 948 action === Debug.StepAction.StepOut || |
| 949 var count = opt_count ? TO_NUMBER(opt_count) : 1; | 949 action === Debug.StepAction.StepNext || |
| 950 return %PrepareStep(this.break_id, action, count); | 950 action === Debug.StepAction.StepFrame) { |
| 951 return %PrepareStep(this.break_id, action); |
| 952 } |
| 953 throw MakeTypeError(kDebuggerType); |
| 951 }; | 954 }; |
| 952 | 955 |
| 953 ExecutionState.prototype.evaluateGlobal = function(source, disable_break, | 956 ExecutionState.prototype.evaluateGlobal = function(source, disable_break, |
| 954 opt_additional_context) { | 957 opt_additional_context) { |
| 955 return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, | 958 return MakeMirror(%DebugEvaluateGlobal(this.break_id, source, |
| 956 TO_BOOLEAN(disable_break), | 959 TO_BOOLEAN(disable_break), |
| 957 opt_additional_context)); | 960 opt_additional_context)); |
| 958 }; | 961 }; |
| 959 | 962 |
| 960 ExecutionState.prototype.frameCount = function() { | 963 ExecutionState.prototype.frameCount = function() { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1444 } catch (e) { | 1447 } catch (e) { |
| 1445 // Failed in one of the catch blocks above - most generic error. | 1448 // Failed in one of the catch blocks above - most generic error. |
| 1446 return '{"seq":0,"type":"response","success":false,"message":"Internal error
"}'; | 1449 return '{"seq":0,"type":"response","success":false,"message":"Internal error
"}'; |
| 1447 } | 1450 } |
| 1448 }; | 1451 }; |
| 1449 | 1452 |
| 1450 | 1453 |
| 1451 DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { | 1454 DebugCommandProcessor.prototype.continueRequest_ = function(request, response) { |
| 1452 // Check for arguments for continue. | 1455 // Check for arguments for continue. |
| 1453 if (request.arguments) { | 1456 if (request.arguments) { |
| 1454 var count = 1; | |
| 1455 var action = Debug.StepAction.StepIn; | 1457 var action = Debug.StepAction.StepIn; |
| 1456 | 1458 |
| 1457 // Pull out arguments. | 1459 // Pull out arguments. |
| 1458 var stepaction = request.arguments.stepaction; | 1460 var stepaction = request.arguments.stepaction; |
| 1459 var stepcount = request.arguments.stepcount; | |
| 1460 | |
| 1461 // Get the stepcount argument if any. | |
| 1462 if (stepcount) { | |
| 1463 count = TO_NUMBER(stepcount); | |
| 1464 if (count < 0) { | |
| 1465 throw MakeError(kDebugger, | |
| 1466 'Invalid stepcount argument "' + stepcount + '".'); | |
| 1467 } | |
| 1468 } | |
| 1469 | 1461 |
| 1470 // Get the stepaction argument. | 1462 // Get the stepaction argument. |
| 1471 if (stepaction) { | 1463 if (stepaction) { |
| 1472 if (stepaction == 'in') { | 1464 if (stepaction == 'in') { |
| 1473 action = Debug.StepAction.StepIn; | 1465 action = Debug.StepAction.StepIn; |
| 1474 } else if (stepaction == 'next') { | 1466 } else if (stepaction == 'next') { |
| 1475 action = Debug.StepAction.StepNext; | 1467 action = Debug.StepAction.StepNext; |
| 1476 } else if (stepaction == 'out') { | 1468 } else if (stepaction == 'out') { |
| 1477 action = Debug.StepAction.StepOut; | 1469 action = Debug.StepAction.StepOut; |
| 1478 } else { | 1470 } else { |
| 1479 throw MakeError(kDebugger, | 1471 throw MakeError(kDebugger, |
| 1480 'Invalid stepaction argument "' + stepaction + '".'); | 1472 'Invalid stepaction argument "' + stepaction + '".'); |
| 1481 } | 1473 } |
| 1482 } | 1474 } |
| 1483 | 1475 |
| 1484 // Set up the VM for stepping. | 1476 // Set up the VM for stepping. |
| 1485 this.exec_state_.prepareStep(action, count); | 1477 this.exec_state_.prepareStep(action); |
| 1486 } | 1478 } |
| 1487 | 1479 |
| 1488 // VM should be running after executing this request. | 1480 // VM should be running after executing this request. |
| 1489 response.running = true; | 1481 response.running = true; |
| 1490 }; | 1482 }; |
| 1491 | 1483 |
| 1492 | 1484 |
| 1493 DebugCommandProcessor.prototype.breakRequest_ = function(request, response) { | 1485 DebugCommandProcessor.prototype.breakRequest_ = function(request, response) { |
| 1494 // Ignore as break command does not do anything when broken. | 1486 // Ignore as break command does not do anything when broken. |
| 1495 }; | 1487 }; |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2611 "IsBreakPointTriggered", IsBreakPointTriggered, | 2603 "IsBreakPointTriggered", IsBreakPointTriggered, |
| 2612 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, | 2604 "UpdateScriptBreakPoints", UpdateScriptBreakPoints, |
| 2613 ]); | 2605 ]); |
| 2614 | 2606 |
| 2615 // Export to liveedit.js | 2607 // Export to liveedit.js |
| 2616 utils.Export(function(to) { | 2608 utils.Export(function(to) { |
| 2617 to.GetScriptBreakPoints = GetScriptBreakPoints; | 2609 to.GetScriptBreakPoints = GetScriptBreakPoints; |
| 2618 }); | 2610 }); |
| 2619 | 2611 |
| 2620 }) | 2612 }) |
| OLD | NEW |