Commit 67bd9450 authored by yangguo's avatar yangguo Committed by Commit bot

[debugger] simplify stepping logic.

Now that we do not support arbitrary step count anymore, we can
make this a lot easier.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/1539483002

Cr-Commit-Position: refs/heads/master@{#32966}
parent e5015918
......@@ -63,8 +63,7 @@ ScopeIterator::ScopeIterator(Isolate* isolate, FrameInspector* frame_inspector,
Address call_pc = GetFrame()->pc() - 1;
// Find the break point where execution has stopped.
BreakLocation location =
BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, call_pc);
BreakLocation location = BreakLocation::FromAddress(debug_info, call_pc);
ignore_nested_scopes = location.IsReturn();
}
......
This diff is collapsed.
......@@ -64,15 +64,12 @@ class BreakLocation {
public:
// Find the break point at the supplied address, or the closest one before
// the address.
static BreakLocation FromAddress(Handle<DebugInfo> debug_info,
BreakLocatorType type, Address pc);
static BreakLocation FromAddress(Handle<DebugInfo> debug_info, Address pc);
static void FromAddressSameStatement(Handle<DebugInfo> debug_info,
BreakLocatorType type, Address pc,
static void FromAddressSameStatement(Handle<DebugInfo> debug_info, Address pc,
List<BreakLocation>* result_out);
static BreakLocation FromPosition(Handle<DebugInfo> debug_info,
BreakLocatorType type, int position,
static BreakLocation FromPosition(Handle<DebugInfo> debug_info, int position,
BreakPositionAlignment alignment);
bool IsDebugBreak() const;
......@@ -152,8 +149,7 @@ class BreakLocation {
friend class Debug;
static int BreakIndexFromAddress(Handle<DebugInfo> debug_info,
BreakLocatorType type, Address pc);
static int BreakIndexFromAddress(Handle<DebugInfo> debug_info, Address pc);
void SetDebugBreak();
void ClearDebugBreak();
......@@ -408,15 +404,12 @@ class Debug {
bool IsBreakOnException(ExceptionBreakType type);
// Stepping handling.
void PrepareStep(StepAction step_action, int step_count);
void PrepareStep(StepAction step_action);
void PrepareStepIn(Handle<JSFunction> function);
void PrepareStepOnThrow();
void ClearStepping();
void ClearStepOut();
void EnableStepIn();
bool IsStepping() { return thread_local_.step_count_ > 0; }
bool StepNextContinue(BreakLocation* location, JavaScriptFrame* frame);
bool StepOutActive() { return thread_local_.step_out_fp_ != 0; }
void GetStepinPositions(JavaScriptFrame* frame, StackFrame::Id frame_id,
List<int>* results_out);
......@@ -624,15 +617,11 @@ class Debug {
// Source statement position from last step next action.
int last_statement_position_;
// Number of steps left to perform before debug event.
int step_count_;
// Frame pointer from last step next or step frame action.
Address last_fp_;
// Frame pointer for the frame where debugger should be called when current
// step out action is completed.
Address step_out_fp_;
// Frame pointer of the target frame we want to arrive at.
Address target_fp_;
// Whether functions are flooded on entry for step-in and step-frame.
// If we stepped out to the embedder, disable flooding to spill stepping
......
......@@ -1231,7 +1231,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
isolate->debug()->ClearStepping();
// Prepare step.
isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), 1);
isolate->debug()->PrepareStep(static_cast<StepAction>(step_action));
return isolate->heap()->undefined_value();
}
......
......@@ -65,16 +65,8 @@ RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) {
catcher.SetVerbose(true);
Handle<Object> argv[] = {argument};
// Allow stepping into the observer callback.
Debug* debug = isolate->debug();
if (debug->is_active() && debug->IsStepping() &&
debug->last_step_action() == StepIn) {
// Previous StepIn may have activated a StepOut if it was at the frame exit.
// In this case to be able to step into the callback again, we need to clear
// the step out first.
debug->ClearStepOut();
debug->FloodWithOneShot(callback);
}
// If we are in step-in mode, flood the handler.
isolate->debug()->EnableStepIn();
USE(Execution::Call(isolate, callback, isolate->factory()->undefined_value(),
arraysize(argv), argv));
......
......@@ -341,7 +341,7 @@ static void ChangeBreakOnExceptionFromJS(v8::Isolate* isolate, bool caught,
// Prepare to step to next break location.
static void PrepareStep(StepAction step_action) {
v8::internal::Debug* debug = CcTest::i_isolate()->debug();
debug->PrepareStep(step_action, 1);
debug->PrepareStep(step_action);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment