* sparc-linux-tdep.c: Update copyright year.

(sparc_linux_sigtramp_start): Change first argument from CORE_ADDR
to struct frame_info *.  Use safe_frame_unwind_memory instead of
deprecated_read_memory_nobpt.
(sparc32_linux_sigtramp_start, sparc32_linux_rt_sigtramp_start):
Change argumen from CORE_ADDR to struct frame_info *.  Adjust for
changed signature of sparc_linux_sigtramp_start.
(sparc32_linux_pc_in_sigtramp): Remove function.
(sparc32_linux_sigtramp_p): New function.
(sparc32_linux_sigtramp_frame_sniffer): Use
sparc32_linux_sigtramp_p instead of sparc32_linux_pc_in_sigtramp.
This commit is contained in:
Mark Kettenis 2004-10-10 17:56:12 +00:00
parent bc73f8cc48
commit ee8aef2357
2 changed files with 34 additions and 20 deletions

View file

@ -1,5 +1,17 @@
2004-10-10 Mark Kettenis <kettenis@gnu.org> 2004-10-10 Mark Kettenis <kettenis@gnu.org>
* sparc-linux-tdep.c: Update copyright year.
(sparc_linux_sigtramp_start): Change first argument from CORE_ADDR
to struct frame_info *. Use safe_frame_unwind_memory instead of
deprecated_read_memory_nobpt.
(sparc32_linux_sigtramp_start, sparc32_linux_rt_sigtramp_start):
Change argumen from CORE_ADDR to struct frame_info *. Adjust for
changed signature of sparc_linux_sigtramp_start.
(sparc32_linux_pc_in_sigtramp): Remove function.
(sparc32_linux_sigtramp_p): New function.
(sparc32_linux_sigtramp_frame_sniffer): Use
sparc32_linux_sigtramp_p instead of sparc32_linux_pc_in_sigtramp.
* sparc-linux-tdep.c (sparc32_linux_svr4_fetch_link_map_offsets): * sparc-linux-tdep.c (sparc32_linux_svr4_fetch_link_map_offsets):
Remove function. Remove function.
(sparc32_linux_init_abi): Don't set solib_svr4_link_map_offsets. (sparc32_linux_init_abi): Don't set solib_svr4_link_map_offsets.

View file

@ -1,6 +1,6 @@
/* Target-dependent code for GNU/Linux SPARC. /* Target-dependent code for GNU/Linux SPARC.
Copyright 2003 Free Software Foundation, Inc. Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -83,10 +83,12 @@
Otherwise, return 0. */ Otherwise, return 0. */
CORE_ADDR CORE_ADDR
sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1) sparc_linux_sigtramp_start (struct frame_info *next_frame,
ULONGEST insn0, ULONGEST insn1)
{ {
CORE_ADDR pc = frame_pc_unwind (next_frame);
ULONGEST word0, word1; ULONGEST word0, word1;
char buf[8]; /* Two instructions. */ unsigned char buf[8]; /* Two instructions. */
/* We only recognize a signal trampoline if PC is at the start of /* We only recognize a signal trampoline if PC is at the start of
one of the instructions. We optimize for finding the PC at the one of the instructions. We optimize for finding the PC at the
@ -96,7 +98,7 @@ sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1)
sequence, there will be a few trailing readable bytes on the sequence, there will be a few trailing readable bytes on the
stack. */ stack. */
if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0) if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
return 0; return 0;
word0 = extract_unsigned_integer (buf, 4); word0 = extract_unsigned_integer (buf, 4);
@ -106,7 +108,7 @@ sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1)
return 0; return 0;
pc -= 4; pc -= 4;
if (deprecated_read_memory_nobpt (pc, buf, sizeof buf) != 0) if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
return 0; return 0;
word0 = extract_unsigned_integer (buf, 4); word0 = extract_unsigned_integer (buf, 4);
@ -120,30 +122,35 @@ sparc_linux_sigtramp_start (CORE_ADDR pc, ULONGEST insn0, ULONGEST insn1)
} }
static CORE_ADDR static CORE_ADDR
sparc32_linux_sigtramp_start (CORE_ADDR pc) sparc32_linux_sigtramp_start (struct frame_info *next_frame)
{ {
return sparc_linux_sigtramp_start (pc, LINUX32_SIGTRAMP_INSN0, return sparc_linux_sigtramp_start (next_frame, LINUX32_SIGTRAMP_INSN0,
LINUX32_SIGTRAMP_INSN1); LINUX32_SIGTRAMP_INSN1);
} }
static CORE_ADDR static CORE_ADDR
sparc32_linux_rt_sigtramp_start (CORE_ADDR pc) sparc32_linux_rt_sigtramp_start (struct frame_info *next_frame)
{ {
return sparc_linux_sigtramp_start (pc, LINUX32_RT_SIGTRAMP_INSN0, return sparc_linux_sigtramp_start (next_frame, LINUX32_RT_SIGTRAMP_INSN0,
LINUX32_RT_SIGTRAMP_INSN1); LINUX32_RT_SIGTRAMP_INSN1);
} }
static int static int
sparc32_linux_pc_in_sigtramp (CORE_ADDR pc, char *name) sparc32_linux_sigtramp_p (struct frame_info *next_frame)
{ {
CORE_ADDR pc = frame_pc_unwind (next_frame);
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
/* If we have NAME, we can optimize the search. The trampolines are /* If we have NAME, we can optimize the search. The trampolines are
named __restore and __restore_rt. However, they aren't dynamically named __restore and __restore_rt. However, they aren't dynamically
exported from the shared C library, so the trampoline may appear to exported from the shared C library, so the trampoline may appear to
be part of the preceding function. This should always be sigaction, be part of the preceding function. This should always be sigaction,
__sigaction, or __libc_sigaction (all aliases to the same function). */ __sigaction, or __libc_sigaction (all aliases to the same function). */
if (name == NULL || strstr (name, "sigaction") != NULL) if (name == NULL || strstr (name, "sigaction") != NULL)
return (sparc32_linux_sigtramp_start (pc) != 0 return (sparc32_linux_sigtramp_start (next_frame) != 0
|| sparc32_linux_rt_sigtramp_start (pc) != 0); || sparc32_linux_rt_sigtramp_start (next_frame) != 0);
return (strcmp ("__restore", name) == 0 return (strcmp ("__restore", name) == 0
|| strcmp ("__restore_rt", name) == 0); || strcmp ("__restore_rt", name) == 0);
@ -170,13 +177,12 @@ sparc32_linux_sigtramp_frame_cache (struct frame_info *next_frame,
regnum = SPARC_O1_REGNUM; regnum = SPARC_O1_REGNUM;
sigcontext_addr = frame_unwind_register_unsigned (next_frame, regnum); sigcontext_addr = frame_unwind_register_unsigned (next_frame, regnum);
cache->pc = frame_pc_unwind (next_frame); addr = sparc32_linux_sigtramp_start (next_frame);
addr = sparc32_linux_sigtramp_start (cache->pc);
if (addr == 0) if (addr == 0)
{ {
/* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR /* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
accordingly. */ accordingly. */
addr = sparc32_linux_rt_sigtramp_start (cache->pc); addr = sparc32_linux_rt_sigtramp_start (next_frame);
if (addr) if (addr)
sigcontext_addr += 128; sigcontext_addr += 128;
else else
@ -239,11 +245,7 @@ static const struct frame_unwind sparc32_linux_sigtramp_frame_unwind =
static const struct frame_unwind * static const struct frame_unwind *
sparc32_linux_sigtramp_frame_sniffer (struct frame_info *next_frame) sparc32_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
{ {
CORE_ADDR pc = frame_pc_unwind (next_frame); if (sparc32_linux_sigtramp_p (next_frame))
char *name;
find_pc_partial_function (pc, &name, NULL, NULL);
if (sparc32_linux_pc_in_sigtramp (pc, name))
return &sparc32_linux_sigtramp_frame_unwind; return &sparc32_linux_sigtramp_frame_unwind;
return NULL; return NULL;