[RFA] Patch to fix "reverse-next" command error

teawater
2009-01-22T09:00:43Z

[-- Attachment #1: Type: text/plain, Size: 668 bytes --]

Hi guys,

This patch is for bug in http://sourceware.org/ml/gdb/2009-01/msg00146.html

This issue is because sometime the inferior is already in function
start address (i.e. plt), set a breakpoint and continue will make
"reverse-next" work error.

This patch make inferior step if it reverse step and stop at the
function start address.
It tested OK with process record patch and testsuite gdb.twreverse in
branch reverse-20081226-branch.

2009-01-22 Hui Zhu <teawater@gmail.com>

* infrun.c (handle_inferior_event): Make inferior step if it
stepping over a function call in reverse , and stop at the
start address of the function.

OK for mainline?

Thanks,
Hui

[-- Attachment #2: fix-reverse-plt-error.txt --]
[-- Type: text/plain, Size: 1105 bytes --]

Index: gdb/infrun.c
===================================================================
--- gdb.orig/infrun.c 2009-01-22 14:58:31.000000000 +0800
+++ gdb/infrun.c 2009-01-22 16:26:46.000000000 +0800
@@ -3488,10 +3488,21 @@
keep_going (ecs);
return;
}
- /* Normal (staticly linked) function call return. */
- init_sal (&sr_sal);
- sr_sal.pc = ecs->stop_func_start;
- insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ if (ecs->stop_func_start != stop_pc)
+ {
+ /* Normal (staticly linked) function call return. */
+ init_sal (&sr_sal);
+ sr_sal.pc = ecs->stop_func_start;
+ insert_step_resume_breakpoint_at_sal (sr_sal, null_frame_id);
+ }
+ else
+ {
+ /* We are stepping over a function call in reverse, and
+ stop at the start address of the function. Go back to
+ single-stepping, which should take us back to the
+ function call. */
+ ecs->event_thread->stepping_over_breakpoint = 1;
+ }
}
else
insert_step_resume_breakpoint_at_caller (get_current_frame ());