// Here we use masm_-> instead of the __ macro to avoid the code coverage
// tool from instrumenting as we rely on the code size here.
int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize;
- CodeGenerator::RecordPositions(masm_, function()->end_position());
+ CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
__ RecordJSReturn();
masm_->mov(sp, fp);
masm_->ldm(ia_w, sp, fp.bit() | lr.bit());
void CodeGenerator::CodeForReturnPosition(FunctionLiteral* fun) {
- if (FLAG_debug_info) RecordPositions(masm(), fun->end_position(), false);
+ if (FLAG_debug_info) RecordPositions(masm(), fun->end_position() - 1, false);
}
// Set the positions to the end of the function.
if (debug_info_->shared()->HasSourceCode()) {
position_ = debug_info_->shared()->end_position() -
- debug_info_->shared()->start_position();
+ debug_info_->shared()->start_position() - 1;
} else {
position_ = 0;
}
void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) {
if (FLAG_debug_info) {
- CodeGenerator::RecordPositions(masm_, fun->end_position());
+ CodeGenerator::RecordPositions(masm_, fun->end_position() - 1);
}
}
Label check_exit_codesize;
masm_->bind(&check_exit_codesize);
#endif
- CodeGenerator::RecordPositions(masm_, function()->end_position());
+ CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
}
Debug::SetBreakPoint(shared, break_point_object_arg, &position);
position += shared->start_position();
-
- // The result position may become beyond script source end.
- // This is expected when the function is toplevel. This may become
- // a problem later when actual position gets converted into line/column.
- if (shared->is_toplevel() && position == shared->end_position()) {
- position = shared->end_position() - 1;
- }
return Smi::FromInt(position);
}
return Heap::undefined_value();
Label check_exit_codesize;
masm_->bind(&check_exit_codesize);
#endif
- CodeGenerator::RecordPositions(masm_, function()->end_position());
+ CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
__ RecordJSReturn();
// Do not use the leave instruction here because it is too short to
// patch with the code required by the debugger.
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
CHECK_EQ(0, last_source_line);
- CHECK_EQ(16, last_source_column);
+ CHECK_EQ(15, last_source_column);
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
CHECK_EQ(0, last_source_line);
- CHECK_EQ(16, last_source_column);
+ CHECK_EQ(15, last_source_column);
// Run without breakpoints.
ClearBreakPoint(bp);
assertEquals("() {a=1;[B0]b=2}", Debug.showBreakPoints(f));
bp2 = Debug.setBreakPoint(f, 0, 4);
assertEquals("() {[B0]a=1;[B1]b=2}", Debug.showBreakPoints(f));
-bp3 = Debug.setBreakPoint(f, 0, 12);
-assertEquals("() {[B0]a=1;[B1]b=2}[B2]", Debug.showBreakPoints(f));
+bp3 = Debug.setBreakPoint(f, 0, 11);
+assertEquals("() {[B0]a=1;[B1]b=2[B2]}", Debug.showBreakPoints(f));
Debug.clearBreakPoint(bp1);
-assertEquals("() {[B0]a=1;b=2}[B1]", Debug.showBreakPoints(f));
+assertEquals("() {[B0]a=1;b=2[B1]}", Debug.showBreakPoints(f));
Debug.clearBreakPoint(bp2);
-assertEquals("() {a=1;b=2}[B0]", Debug.showBreakPoints(f));
+assertEquals("() {a=1;b=2[B0]}", Debug.showBreakPoints(f));
Debug.clearBreakPoint(bp3);
assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f));
// }[B2]
assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0);
-assertTrue(Debug.showBreakPoints(g).indexOf("}[B2]") > 0);
+assertTrue(Debug.showBreakPoints(g).indexOf("[B2]}") > 0);
Debug.clearBreakPoint(bp1);
// function g() {
// [B0]a=1;
// b=2;
// }[B1]
assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0);
-assertTrue(Debug.showBreakPoints(g).indexOf("}[B1]") > 0);
+assertTrue(Debug.showBreakPoints(g).indexOf("[B1]}") > 0);
assertTrue(Debug.showBreakPoints(g).indexOf("[B2]") < 0);
Debug.clearBreakPoint(bp2);
// function g() {
// a=1;
// b=2;
// }[B0]
-assertTrue(Debug.showBreakPoints(g).indexOf("}[B0]") > 0);
+assertTrue(Debug.showBreakPoints(g).indexOf("[B0]}") > 0);
assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0);
Debug.clearBreakPoint(bp3);
// function g() {
// Conditional breakpoint which checks a local variable.
break_point_hit_count = 0;
-bp = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0');
+bp = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
for (var i = 0; i < 10; i++) {
g();
}
// Multiple conditional breakpoint which the same condition.
break_point_hit_count = 0;
-bp1 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0');
-bp2 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0');
+bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
+bp2 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
for (var i = 0; i < 10; i++) {
g();
}
// Multiple conditional breakpoint which different conditions.
break_point_hit_count = 0;
-bp1 = Debug.setBreakPoint(h, 0, 23, 'a % 2 == 0');
-bp2 = Debug.setBreakPoint(h, 0, 23, '(a + 1) % 2 == 0');
+bp1 = Debug.setBreakPoint(h, 0, 22, 'a % 2 == 0');
+bp2 = Debug.setBreakPoint(h, 0, 22, '(a + 1) % 2 == 0');
for (var i = 0; i < 10; i++) {
g();
}
exec_state.prepareStep(Debug.StepAction.StepIn, 1);
} else {
// Position at the end of the function.
- assertEquals(debugger_source_position + 51,
+ assertEquals(debugger_source_position + 50,
exec_state.frame(0).sourcePosition());
// Just about to return from the function.