[RFA] Handle runtime loader dyn sym resolution in reverse

Michael Snyder
2008-10-25T03:04:22Z

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

This is for both the main trunk and the record/replay branch
(so I'd appreciate review by both Hui and a global maintainer).

It fixes a bug where you try to "reverse-next" over a
first-time dynamic function call (eg. printf). Infrun
would get lost when it stepped into the jump table
backwards.

[-- Attachment #2: shmain.txt --]
[-- Type: text/plain, Size: 1210 bytes --]

2008-10-24 Michael Snyder <msnyder@vmware.com>

* infrun.c (handle_inferior_event): Handle dynamic symbol
resolution in reverse.

Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.322.2.14
diff -u -p -r1.322.2.14 infrun.c
--- infrun.c 23 Oct 2008 23:24:45 -0000 1.322.2.14
+++ infrun.c 25 Oct 2008 02:57:37 -0000
@@ -3212,6 +3212,22 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (
if (execution_direction == EXEC_REVERSE)
{
struct symtab_and_line sr_sal;
+
+ if (ecs->stop_func_start == 0
+ && in_solib_dynsym_resolve_code (stop_pc))
+ {
+ /* Stepped into runtime loader dynamic symbol
+ resolution code. Since we're in reverse,
+ we have already backed up through the runtime
+ loader and the dynamic function. This is just
+ the trampoline (jump table).
+
+ Just keep stepping, we'll soon be home.
+ */
+ 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);