mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-28 01:50:48 +00:00
* objfiles.h (pc_in_section): New prototype.
(in_plt_section): Remove name argument, replace prototype with static inline function. * mips-tdep.h: Include "objfiles.h". (in_mips_stubs_section): New function. * hppa-tdep.h (gdbarch_tdep): Remove name argument of in_solib_call_trampoline member. (hppa_in_solib_call_trampoline): Remove name argument. * objfiles.c (pc_in_section): New function. (in_plt_section): Remove function. * mips-linux-tdep.c: Include "objfiles.h". (mips_linux_in_dynsym_stub): Call in_mips_stubs_section. Remove name argument. Return 1 rather than the low 16-bit halfword of any instruction examined. (mips_linux_in_dynsym_resolve_code): Update mips_linux_in_dynsym_stub call accordingly. * mips-tdep.c (mips_stub_frame_sniffer): Use in_mips_stubs_section rather than an equivalent hand-coded sequence. * hppa-hpux-tdep.c (in_opd_section): Remove function. (hppa32_hpux_in_solib_call_trampoline): Remove name argument. (hppa64_hpux_in_solib_call_trampoline): Likewise. (hppa64_hpux_find_global_pointer): Use pc_in_section rather than in_opd_section. * hppa-tdep.c (hppa_stub_unwind_sniffer): Remove name argument on call to tdep->in_solib_call_trampoline. (hppa_in_solib_call_trampoline): Remove name argument, update according to in_plt_section change. (hppa_skip_trampoline_code): Update according to in_plt_section change. * aarch64-tdep.c (aarch64_stub_unwind_sniffer): Likewise. * arm-symbian-tdep.c (arm_symbian_skip_trampoline_code): Likewise. * arm-tdep.c (arm_stub_unwind_sniffer): Likewise. * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. * hppabsd-tdep.c (hppabsd_find_global_pointer): Likewise. * nios2-tdep.c (nios2_stub_frame_sniffer): Likewise. * nto-tdep.c (nto_relocate_section_addresses): Likewise. * s390-tdep.c (s390_stub_frame_sniffer): Likewise. * sh-tdep.c (sh_stub_unwind_sniffer): Likewise. * solib-dsbt.c (dsbt_in_dynsym_resolve_code): Likewise. * solib-frv.c (frv_in_dynsym_resolve_code): Likewise. * solib-svr4.c (svr4_in_dynsym_resolve_code): Likewise. * solib-target.c (solib_target_in_dynsym_resolve_code): Likewise. * sparc-tdep.c (sparc_analyze_prologue): Likewise. * tic6x-tdep.c (tic6x_stub_unwind_sniffer): Likewise.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "trad-frame.h"
|
||||
#include "tramp-frame.h"
|
||||
#include "gdbtypes.h"
|
||||
#include "objfiles.h"
|
||||
#include "solib.h"
|
||||
#include "solib-svr4.h"
|
||||
#include "solist.h"
|
||||
@@ -666,25 +667,34 @@ mips_linux_core_read_description (struct gdbarch *gdbarch,
|
||||
|
||||
|
||||
/* Check the code at PC for a dynamic linker lazy resolution stub.
|
||||
Because they aren't in the .plt section, we pattern-match on the
|
||||
code generated by GNU ld. They look like this:
|
||||
GNU ld for MIPS has put lazy resolution stubs into a ".MIPS.stubs"
|
||||
section uniformly since version 2.15. If the pc is in that section,
|
||||
then we are in such a stub. Before that ".stub" was used in 32-bit
|
||||
ELF binaries, however we do not bother checking for that since we
|
||||
have never had and that case should be extremely rare these days.
|
||||
Instead we pattern-match on the code generated by GNU ld. They look
|
||||
like this:
|
||||
|
||||
lw t9,0x8010(gp)
|
||||
addu t7,ra
|
||||
jalr t9,ra
|
||||
addiu t8,zero,INDEX
|
||||
|
||||
(with the appropriate doubleword instructions for N64). Also
|
||||
return the dynamic symbol index used in the last instruction. */
|
||||
(with the appropriate doubleword instructions for N64). As any lazy
|
||||
resolution stubs in microMIPS binaries will always be in a
|
||||
".MIPS.stubs" section we only ever verify standard MIPS patterns. */
|
||||
|
||||
static int
|
||||
mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
|
||||
mips_linux_in_dynsym_stub (CORE_ADDR pc)
|
||||
{
|
||||
gdb_byte buf[28], *p;
|
||||
ULONGEST insn, insn1;
|
||||
int n64 = (mips_abi (target_gdbarch ()) == MIPS_ABI_N64);
|
||||
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
||||
|
||||
if (in_mips_stubs_section (pc))
|
||||
return 1;
|
||||
|
||||
read_memory (pc - 12, buf, 28);
|
||||
|
||||
if (n64)
|
||||
@@ -742,7 +752,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (insn & 0xffff);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return non-zero iff PC belongs to the dynamic linker resolution
|
||||
@@ -756,9 +766,10 @@ mips_linux_in_dynsym_resolve_code (CORE_ADDR pc)
|
||||
if (svr4_in_dynsym_resolve_code (pc))
|
||||
return 1;
|
||||
|
||||
/* Pattern match for the stub. It would be nice if there were a
|
||||
more efficient way to avoid this check. */
|
||||
if (mips_linux_in_dynsym_stub (pc, NULL))
|
||||
/* Likewise for the stubs. They live in the .MIPS.stubs section these
|
||||
days, so we check if the PC is within, than fall back to a pattern
|
||||
match. */
|
||||
if (mips_linux_in_dynsym_stub (pc))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user