Commit bead2448 authored by yangguo's avatar yangguo Committed by Commit bot

[debugger] remove frame argument for prepare step.

The third argument optionally specifies the frame from which to step.
This feature is not used and not well tested.

R=jkummerow@chromium.org
BUG=chromium:569835
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#32865}
parent 1362f935
......@@ -493,7 +493,7 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) {
// Clear queue
thread_local_.queued_step_count_ = 0;
PrepareStep(StepNext, step_count, StackFrame::NO_ID);
PrepareStep(StepNext, step_count);
} else {
// Notify the debug event listeners.
OnDebugBreak(break_points_hit, false);
......@@ -531,7 +531,7 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) {
ClearStepping();
// Set up for the remaining steps.
PrepareStep(step_action, step_count, StackFrame::NO_ID);
PrepareStep(step_action, step_count);
}
}
......@@ -833,9 +833,7 @@ void Debug::PrepareStepOnThrow() {
}
void Debug::PrepareStep(StepAction step_action,
int step_count,
StackFrame::Id frame_id) {
void Debug::PrepareStep(StepAction step_action, int step_count) {
HandleScope scope(isolate_);
DCHECK(in_debug_scope());
......@@ -844,15 +842,11 @@ void Debug::PrepareStep(StepAction step_action,
// any. The debug frame will only be present if execution was stopped due to
// hitting a break point. In other situations (e.g. unhandled exception) the
// debug frame is not present.
StackFrame::Id id = break_frame_id();
if (id == StackFrame::NO_ID) {
StackFrame::Id frame_id = break_frame_id();
// If there is no JavaScript stack don't do anything.
return;
}
if (frame_id != StackFrame::NO_ID) {
id = frame_id;
}
JavaScriptFrameIterator frames_it(isolate_, id);
if (frame_id == StackFrame::NO_ID) return;
JavaScriptFrameIterator frames_it(isolate_, frame_id);
JavaScriptFrame* frame = frames_it.frame();
feature_tracker()->Track(DebugFeatureTracker::kStepping);
......
......@@ -408,9 +408,7 @@ class Debug {
bool IsBreakOnException(ExceptionBreakType type);
// Stepping handling.
void PrepareStep(StepAction step_action,
int step_count,
StackFrame::Id frame_id);
void PrepareStep(StepAction step_action, int step_count);
void PrepareStepIn(Handle<JSFunction> function);
void PrepareStepOnThrow();
void ClearStepping();
......
......@@ -943,17 +943,11 @@ function ExecutionState(break_id) {
this.selected_frame = 0;
}
ExecutionState.prototype.prepareStep = function(opt_action, opt_count,
opt_callframe) {
ExecutionState.prototype.prepareStep = function(opt_action, opt_count) {
var action = Debug.StepAction.StepIn;
if (!IS_UNDEFINED(opt_action)) action = TO_NUMBER(opt_action);
var count = opt_count ? TO_NUMBER(opt_count) : 1;
var callFrameId = 0;
if (!IS_UNDEFINED(opt_callframe)) {
callFrameId = opt_callframe.details_.frameId();
}
return %PrepareStep(this.break_id, action, count, callFrameId);
return %PrepareStep(this.break_id, action, count);
};
ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
......
......@@ -1212,7 +1212,7 @@ RUNTIME_FUNCTION(Runtime_IsBreakOnException) {
// of frames to step down.
RUNTIME_FUNCTION(Runtime_PrepareStep) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
DCHECK(args.length() == 3);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id));
......@@ -1220,15 +1220,6 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
return isolate->Throw(isolate->heap()->illegal_argument_string());
}
CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]);
StackFrame::Id frame_id;
if (wrapped_frame_id == 0) {
frame_id = StackFrame::NO_ID;
} else {
frame_id = DebugFrameHelper::UnwrapFrameId(wrapped_frame_id);
}
// Get the step action and check validity.
StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1]));
if (step_action != StepIn && step_action != StepNext &&
......@@ -1236,11 +1227,6 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
return isolate->Throw(isolate->heap()->illegal_argument_string());
}
if (frame_id != StackFrame::NO_ID && step_action != StepNext &&
step_action != StepOut) {
return isolate->ThrowIllegalOperation();
}
// Get the number of steps.
int step_count = NumberToInt32(args[2]);
if (step_count < 1) {
......@@ -1252,7 +1238,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
// Prepare step.
isolate->debug()->PrepareStep(static_cast<StepAction>(step_action),
step_count, frame_id);
step_count);
return isolate->heap()->undefined_value();
}
......
......@@ -183,7 +183,7 @@ namespace internal {
F(ClearBreakPoint, 1, 1) \
F(ChangeBreakOnException, 2, 1) \
F(IsBreakOnException, 1, 1) \
F(PrepareStep, 4, 1) \
F(PrepareStep, 3, 1) \
F(ClearStepping, 0, 1) \
F(DebugEvaluate, 6, 1) \
F(DebugEvaluateGlobal, 4, 1) \
......
......@@ -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, StackFrame::NO_ID);
debug->PrepareStep(step_action, 1);
}
......
......@@ -53,8 +53,8 @@ function h() {
}
}
function TestCase(frame_index, step_count, expected_final_state) {
print("Test case, parameters " + frame_index + "/" + step_count);
function TestCase(step_count, expected_final_state) {
print("Test case, step count: " + step_count);
var listener_exception = null;
var state_snapshot;
......@@ -68,12 +68,7 @@ function TestCase(frame_index, step_count, expected_final_state) {
if (event == Debug.DebugEvent.Break) {
if (listener_state == 0) {
Debug.clearBreakPoint(bp);
var context_frame;
if (frame_index !== undefined) {
context_frame = exec_state.frame(frame_index);
}
exec_state.prepareStep(Debug.StepAction.StepNext,
step_count, context_frame);
exec_state.prepareStep(Debug.StepAction.StepNext, step_count);
listener_state = 1;
} else if (listener_state == 1) {
state_snapshot = String(state);
......@@ -107,26 +102,8 @@ function TestCase(frame_index, step_count, expected_final_state) {
// Warm-up -- make sure all is compiled and ready for breakpoint.
h();
// Stepping in the default (top) frame.
TestCase(undefined, 0, "0,0,-1");
TestCase(undefined, 1, "0,0,-1");
TestCase(undefined, 2, "0,0,0");
TestCase(undefined, 5, "0,0,1");
TestCase(undefined, 8, "0,0,3");
// Stepping in the frame #0 (should be exactly the same as above).
TestCase(0, 0, "0,0,-1");
TestCase(0, 1, "0,0,-1");
TestCase(0, 2, "0,0,0");
TestCase(0, 5, "0,0,1");
TestCase(0, 8, "0,0,3");
// Stepping in the frame #1.
TestCase(1, 0, "0,0,3");
TestCase(1, 3, "0,1,3");
TestCase(1, 7, "0,3,3");
// Stepping in the frame #2.
TestCase(2, 3, "1,3,3");
TestCase(2, 7, "3,3,3");
TestCase(0, "0,0,-1");
TestCase(1, "0,0,-1");
TestCase(2, "0,0,0");
TestCase(5, "0,0,1");
TestCase(8, "0,0,2");
......@@ -30,11 +30,6 @@
# All tests in the bug directory are expected to fail.
'bugs/*': [FAIL],
##############################################################################
# Flaky tests.
# BUG(v8:2921).
'debug-step-4-in-frame': [PASS, FAIL, SLOW],
##############################################################################
# Fails.
'regress/regress-1119': [FAIL],
......
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