Revision: 9264
Author: [email protected]
Date: Tue Sep 13 07:38:39 2011
Log: Debugger: fix stepping next with trycatch recursion
Added depth check to StepNextContinue. Do step out and queue actual
StepNext if check failed.
[email protected],[email protected],[email protected]
BUG=v8:1639
TEST=
Review URL: http://codereview.chromium.org/7780033
Patch from Fedor Indutny <[email protected]>.
http://code.google.com/p/v8/source/detail?r=9264
Modified:
/branches/bleeding_edge/AUTHORS
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/debug.h
=======================================
--- /branches/bleeding_edge/AUTHORS Thu Jun 30 22:50:14 2011
+++ /branches/bleeding_edge/AUTHORS Tue Sep 13 07:38:39 2011
@@ -21,6 +21,7 @@
Daniel James <[email protected]>
Dineel D Sule <[email protected]>
Erich Ocean <[email protected]>
+Fedor Indutny <[email protected]>
Jan de Mooij <[email protected]>
Jay Freeman <[email protected]>
Joel Stanley <[email protected]>
=======================================
--- /branches/bleeding_edge/src/debug.cc Tue Sep 13 01:31:21 2011
+++ /branches/bleeding_edge/src/debug.cc Tue Sep 13 07:38:39 2011
@@ -543,6 +543,7 @@
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
thread_local_.step_count_ = 0;
thread_local_.last_fp_ = 0;
+ thread_local_.queued_step_count_ = 0;
thread_local_.step_into_fp_ = 0;
thread_local_.step_out_fp_ = 0;
thread_local_.after_break_target_ = 0;
@@ -958,13 +959,48 @@
// Clear all current stepping setup.
ClearStepping();
- // Notify the debug event listeners.
- isolate_->debugger()->OnDebugBreak(break_points_hit, false);
+ if (thread_local_.queued_step_count_ > 0) {
+ // Perform queued steps
+ int step_count = thread_local_.queued_step_count_;
+
+ // Clear queue
+ thread_local_.queued_step_count_ = 0;
+
+ PrepareStep(StepNext, step_count);
+ } else {
+ // Notify the debug event listeners.
+ isolate_->debugger()->OnDebugBreak(break_points_hit, false);
+ }
} else if (thread_local_.last_step_action_ != StepNone) {
// Hold on to last step action as it is cleared by the call to
// ClearStepping.
StepAction step_action = thread_local_.last_step_action_;
int step_count = thread_local_.step_count_;
+
+ // If StepNext goes deeper in code, StepOut until original frame
+ // and keep step count queued up in the meantime.
+ if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) {
+ // Count frames until target frame
+ int count = 0;
+ JavaScriptFrameIterator it(isolate_);
+ while (!it.done() && it.frame()->fp() != thread_local_.last_fp_) {
+ count++;
+ it.Advance();
+ }
+
+ // If we found original frame
+ if (it.frame()->fp() == thread_local_.last_fp_) {
+ if (step_count > 1) {
+ // Save old count and action to continue stepping after
+ // StepOut
+ thread_local_.queued_step_count_ = step_count - 1;
+ }
+
+ // Set up for StepOut to reach target frame
+ step_action = StepOut;
+ step_count = count;
+ }
+ }
// Clear all current stepping setup.
ClearStepping();
@@ -1455,6 +1491,13 @@
// steps before reporting break back to the debugger.
bool Debug::StepNextContinue(BreakLocationIterator*
break_location_iterator,
JavaScriptFrame* frame) {
+ // StepNext and StepOut shouldn't bring us deeper in code, so last frame
+ // shouldn't be a parent of current frame.
+ if (thread_local_.last_step_action_ == StepNext ||
+ thread_local_.last_step_action_ == StepOut) {
+ if (frame->fp() < thread_local_.last_fp_) return true;
+ }
+
// If the step last action was step next or step in make sure that a new
// statement is hit.
if (thread_local_.last_step_action_ == StepNext ||
=======================================
--- /branches/bleeding_edge/src/debug.h Tue Sep 13 01:31:21 2011
+++ /branches/bleeding_edge/src/debug.h Tue Sep 13 07:38:39 2011
@@ -508,6 +508,9 @@
// Frame pointer from last step next action.
Address last_fp_;
+ // Number of queued steps left to perform before debug event.
+ int queued_step_count_;
+
// Frame pointer for frame from which step in was performed.
Address step_into_fp_;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev