OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 // Clear all current stepping setup. | 1010 // Clear all current stepping setup. |
1011 ClearStepping(); | 1011 ClearStepping(); |
1012 | 1012 |
1013 if (thread_local_.queued_step_count_ > 0) { | 1013 if (thread_local_.queued_step_count_ > 0) { |
1014 // Perform queued steps | 1014 // Perform queued steps |
1015 int step_count = thread_local_.queued_step_count_; | 1015 int step_count = thread_local_.queued_step_count_; |
1016 | 1016 |
1017 // Clear queue | 1017 // Clear queue |
1018 thread_local_.queued_step_count_ = 0; | 1018 thread_local_.queued_step_count_ = 0; |
1019 | 1019 |
1020 PrepareStep(StepNext, step_count); | 1020 PrepareStep(StepNext, step_count, StackFrame::NO_ID); |
1021 } else { | 1021 } else { |
1022 // Notify the debug event listeners. | 1022 // Notify the debug event listeners. |
1023 isolate_->debugger()->OnDebugBreak(break_points_hit, false); | 1023 isolate_->debugger()->OnDebugBreak(break_points_hit, false); |
1024 } | 1024 } |
1025 } else if (thread_local_.last_step_action_ != StepNone) { | 1025 } else if (thread_local_.last_step_action_ != StepNone) { |
1026 // Hold on to last step action as it is cleared by the call to | 1026 // Hold on to last step action as it is cleared by the call to |
1027 // ClearStepping. | 1027 // ClearStepping. |
1028 StepAction step_action = thread_local_.last_step_action_; | 1028 StepAction step_action = thread_local_.last_step_action_; |
1029 int step_count = thread_local_.step_count_; | 1029 int step_count = thread_local_.step_count_; |
1030 | 1030 |
(...skipping 17 matching lines...) Expand all Loading... |
1048 | 1048 |
1049 // Set up for StepOut to reach target frame. | 1049 // Set up for StepOut to reach target frame. |
1050 step_action = StepOut; | 1050 step_action = StepOut; |
1051 step_count = count; | 1051 step_count = count; |
1052 } | 1052 } |
1053 | 1053 |
1054 // Clear all current stepping setup. | 1054 // Clear all current stepping setup. |
1055 ClearStepping(); | 1055 ClearStepping(); |
1056 | 1056 |
1057 // Set up for the remaining steps. | 1057 // Set up for the remaining steps. |
1058 PrepareStep(step_action, step_count); | 1058 PrepareStep(step_action, step_count, StackFrame::NO_ID); |
1059 } | 1059 } |
1060 | 1060 |
1061 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { | 1061 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { |
1062 SetAfterBreakTarget(frame); | 1062 SetAfterBreakTarget(frame); |
1063 } else if (thread_local_.frame_drop_mode_ == | 1063 } else if (thread_local_.frame_drop_mode_ == |
1064 FRAME_DROPPED_IN_IC_CALL) { | 1064 FRAME_DROPPED_IN_IC_CALL) { |
1065 // We must have been calling IC stub. Do not go there anymore. | 1065 // We must have been calling IC stub. Do not go there anymore. |
1066 Code* plain_return = isolate_->builtins()->builtin( | 1066 Code* plain_return = isolate_->builtins()->builtin( |
1067 Builtins::kPlainReturn_LiveEdit); | 1067 Builtins::kPlainReturn_LiveEdit); |
1068 thread_local_.after_break_target_ = plain_return->entry(); | 1068 thread_local_.after_break_target_ = plain_return->entry(); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 | 1369 |
1370 bool Debug::IsBreakOnException(ExceptionBreakType type) { | 1370 bool Debug::IsBreakOnException(ExceptionBreakType type) { |
1371 if (type == BreakUncaughtException) { | 1371 if (type == BreakUncaughtException) { |
1372 return break_on_uncaught_exception_; | 1372 return break_on_uncaught_exception_; |
1373 } else { | 1373 } else { |
1374 return break_on_exception_; | 1374 return break_on_exception_; |
1375 } | 1375 } |
1376 } | 1376 } |
1377 | 1377 |
1378 | 1378 |
1379 void Debug::PrepareStep(StepAction step_action, int step_count) { | 1379 void Debug::PrepareStep(StepAction step_action, |
| 1380 int step_count, |
| 1381 StackFrame::Id frame_id) { |
1380 HandleScope scope(isolate_); | 1382 HandleScope scope(isolate_); |
1381 | 1383 |
1382 PrepareForBreakPoints(); | 1384 PrepareForBreakPoints(); |
1383 | 1385 |
1384 ASSERT(Debug::InDebugger()); | 1386 ASSERT(Debug::InDebugger()); |
1385 | 1387 |
1386 // Remember this step action and count. | 1388 // Remember this step action and count. |
1387 thread_local_.last_step_action_ = step_action; | 1389 thread_local_.last_step_action_ = step_action; |
1388 if (step_action == StepOut) { | 1390 if (step_action == StepOut) { |
1389 // For step out target frame will be found on the stack so there is no need | 1391 // For step out target frame will be found on the stack so there is no need |
1390 // to set step counter for it. It's expected to always be 0 for StepOut. | 1392 // to set step counter for it. It's expected to always be 0 for StepOut. |
1391 thread_local_.step_count_ = 0; | 1393 thread_local_.step_count_ = 0; |
1392 } else { | 1394 } else { |
1393 thread_local_.step_count_ = step_count; | 1395 thread_local_.step_count_ = step_count; |
1394 } | 1396 } |
1395 | 1397 |
1396 // Get the frame where the execution has stopped and skip the debug frame if | 1398 // Get the frame where the execution has stopped and skip the debug frame if |
1397 // any. The debug frame will only be present if execution was stopped due to | 1399 // any. The debug frame will only be present if execution was stopped due to |
1398 // hitting a break point. In other situations (e.g. unhandled exception) the | 1400 // hitting a break point. In other situations (e.g. unhandled exception) the |
1399 // debug frame is not present. | 1401 // debug frame is not present. |
1400 StackFrame::Id id = break_frame_id(); | 1402 StackFrame::Id id = break_frame_id(); |
1401 if (id == StackFrame::NO_ID) { | 1403 if (id == StackFrame::NO_ID) { |
1402 // If there is no JavaScript stack don't do anything. | 1404 // If there is no JavaScript stack don't do anything. |
1403 return; | 1405 return; |
1404 } | 1406 } |
| 1407 if (frame_id != StackFrame::NO_ID) { |
| 1408 id = frame_id; |
| 1409 } |
1405 JavaScriptFrameIterator frames_it(isolate_, id); | 1410 JavaScriptFrameIterator frames_it(isolate_, id); |
1406 JavaScriptFrame* frame = frames_it.frame(); | 1411 JavaScriptFrame* frame = frames_it.frame(); |
1407 | 1412 |
1408 // First of all ensure there is one-shot break points in the top handler | 1413 // First of all ensure there is one-shot break points in the top handler |
1409 // if any. | 1414 // if any. |
1410 FloodHandlerWithOneShot(); | 1415 FloodHandlerWithOneShot(); |
1411 | 1416 |
1412 // If the function on the top frame is unresolved perform step out. This will | 1417 // If the function on the top frame is unresolved perform step out. This will |
1413 // be the case when calling unknown functions and having the debugger stopped | 1418 // be the case when calling unknown functions and having the debugger stopped |
1414 // in an unhandled exception. | 1419 // in an unhandled exception. |
(...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 { | 3844 { |
3840 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3845 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3841 isolate_->debugger()->CallMessageDispatchHandler(); | 3846 isolate_->debugger()->CallMessageDispatchHandler(); |
3842 } | 3847 } |
3843 } | 3848 } |
3844 } | 3849 } |
3845 | 3850 |
3846 #endif // ENABLE_DEBUGGER_SUPPORT | 3851 #endif // ENABLE_DEBUGGER_SUPPORT |
3847 | 3852 |
3848 } } // namespace v8::internal | 3853 } } // namespace v8::internal |
OLD | NEW |