summaryrefslogtreecommitdiff
path: root/gdb/i386-linux-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/i386-linux-tdep.c')
-rw-r--r--gdb/i386-linux-tdep.c61
1 files changed, 26 insertions, 35 deletions
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 2fe4d0481a9..30a8e6a4a04 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -239,50 +239,41 @@ i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
|| strcmp ("__restore_rt", name) == 0);
}
-/* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
- address of the associated sigcontext structure. */
+/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
+ routine, return the address of the associated sigcontext structure. */
static CORE_ADDR
-i386_linux_sigcontext_addr (struct frame_info *frame)
+i386_linux_sigcontext_addr (struct frame_info *next_frame)
{
CORE_ADDR pc;
+ CORE_ADDR sp;
+ char buf[4];
- pc = i386_linux_sigtramp_start (get_frame_pc (frame));
+ frame_unwind_register (next_frame, SP_REGNUM, buf);
+ sp = extract_address (buf, 4);
+
+ pc = i386_linux_sigtramp_start (frame_pc_unwind (next_frame));
if (pc)
{
- CORE_ADDR sp;
-
- if (get_next_frame (frame))
- /* If this isn't the top frame, the next frame must be for the
- signal handler itself. The sigcontext structure lives on
- the stack, right after the signum argument. */
- return get_frame_base (get_next_frame (frame)) + 12;
-
- /* This is the top frame. We'll have to find the address of the
- sigcontext structure by looking at the stack pointer. Keep
- in mind that the first instruction of the sigtramp code is
- "pop %eax". If the PC is at this instruction, adjust the
- returned value accordingly. */
- sp = read_register (SP_REGNUM);
- if (pc == get_frame_pc (frame))
+ /* The sigcontext structure lives on the stack, right after
+ the signum argument. We determine the address of the
+ sigcontext structure by looking at the frame's stack
+ pointer. Keep in mind that the first instruction of the
+ sigtramp code is "pop %eax". If the PC is after this
+ instruction, adjust the returned value accordingly. */
+ if (pc == frame_pc_unwind (next_frame))
return sp + 4;
return sp;
}
- pc = i386_linux_rt_sigtramp_start (get_frame_pc (frame));
+ pc = i386_linux_rt_sigtramp_start (frame_pc_unwind (next_frame));
if (pc)
{
- if (get_next_frame (frame))
- /* If this isn't the top frame, the next frame must be for the
- signal handler itself. The sigcontext structure is part of
- the user context. A pointer to the user context is passed
- as the third argument to the signal handler. */
- return read_memory_integer (get_frame_base (get_next_frame (frame))
- + 16, 4) + 20;
-
- /* This is the top frame. Again, use the stack pointer to find
- the address of the sigcontext structure. */
- return read_memory_integer (read_register (SP_REGNUM) + 8, 4) + 20;
+ /* The sigcontext structure is part of the user context. A
+ pointer to the user context is passed as the third argument
+ to the signal handler. */
+ read_memory (sp + 8, 4, buf);
+ return extract_address (buf, 4) + 20;
}
error ("Couldn't recognize signal trampoline.");
@@ -345,9 +336,9 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p)
}
static CORE_ADDR
-skip_hurd_resolver (CORE_ADDR pc)
+skip_gnu_resolver (CORE_ADDR pc)
{
- /* The HURD dynamic linker is part of the GNU C library, so many
+ /* The GNU dynamic linker is part of the GNU C library, so many
GNU/Linux distributions use it. (All ELF versions, as far as I
know.) An unresolved PLT entry points to "_dl_runtime_resolve",
which calls "fixup" to patch the PLT, and then passes control to
@@ -374,7 +365,7 @@ skip_hurd_resolver (CORE_ADDR pc)
= lookup_minimal_symbol ("fixup", NULL, objfile);
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
- return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
+ return frame_pc_unwind (get_current_frame ());
}
return 0;
@@ -393,7 +384,7 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc)
CORE_ADDR result;
/* Plug in functions for other kinds of resolvers here. */
- result = skip_hurd_resolver (pc);
+ result = skip_gnu_resolver (pc);
if (result)
return result;