diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-05-09 19:32:18 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-05-09 19:32:18 +0000 |
commit | ff43252f553c0fe3579033f6fa874248b7aafe53 (patch) | |
tree | 31173915abe5c54d8511e4ebce7ee83c1c6a21b5 /gnu/usr.bin/binutils | |
parent | dc6f22cc477ac2269ad3975da80225fe4bf9a7bf (diff) |
Allow gdb on m88k to fetch symbols from shared libraries when debugging
dynamically linked binaries. Borrowed from m68k with trivial changes.
ok kettenis@
Diffstat (limited to 'gnu/usr.bin/binutils')
-rw-r--r-- | gnu/usr.bin/binutils/gdb/Makefile.in | 5 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/config/m88k/obsd.mt | 2 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/m88k-tdep.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/binutils/gdb/m88kbsd-tdep.c | 78 |
4 files changed, 87 insertions, 2 deletions
diff --git a/gnu/usr.bin/binutils/gdb/Makefile.in b/gnu/usr.bin/binutils/gdb/Makefile.in index 6de14c8ee87..b105b4080e9 100644 --- a/gnu/usr.bin/binutils/gdb/Makefile.in +++ b/gnu/usr.bin/binutils/gdb/Makefile.in @@ -1388,7 +1388,7 @@ ALLDEPFILES = \ m32r-linux-nat.c m32r-linux-tdep.c \ m68k-tdep.c \ m68kbsd-nat.c m68kbsd-tdep.c \ - m88k-tdep.c m88kbsd-nat.c \ + m88k-tdep.c m88kbsd-nat.c m88kbsd-tdep.c \ mcore-tdep.c \ mips-linux-nat.c mips-linux-tdep.c \ mips-irix-tdep.c \ @@ -2198,6 +2198,9 @@ m88k-tdep.o: m88k-tdep.c $(defs_h) $(arch_utils_h) $(dis_asm_h) $(frame_h) \ $(frame_base_h) $(frame_unwind_h) $(gdbcore_h) $(gdbtypes_h) \ $(regcache_h) $(regset_h) $(symtab_h) $(trad_frame_h) $(value_h) \ $(gdb_assert_h) $(gdb_string_h) $(m88k_tdep_h) +m88kbsd-tdep.o: m88kbsd-tdep.c $(defs_h) $(arch_utils_h) $(osabi_h) \ + $(regcache_h) $(regset_h) $(gdb_assert_h) $(gdb_string_h) \ + $(m88k_tdep_h) $(solib_svr4_h) macrocmd.o: macrocmd.c $(defs_h) $(macrotab_h) $(macroexp_h) $(macroscope_h) \ $(command_h) $(gdbcmd_h) macroexp.o: macroexp.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(macrotab_h) \ diff --git a/gnu/usr.bin/binutils/gdb/config/m88k/obsd.mt b/gnu/usr.bin/binutils/gdb/config/m88k/obsd.mt index 49f8acb147a..66a0eebc689 100644 --- a/gnu/usr.bin/binutils/gdb/config/m88k/obsd.mt +++ b/gnu/usr.bin/binutils/gdb/config/m88k/obsd.mt @@ -1,3 +1,3 @@ # Target: OpenBSD/m88k -TDEPFILES= m88k-tdep.o corelow.o solib.o solib-svr4.o +TDEPFILES= m88k-tdep.o m88kbsd-tdep.o corelow.o solib.o solib-svr4.o DEPRECATED_TM_FILE= solib.h diff --git a/gnu/usr.bin/binutils/gdb/m88k-tdep.c b/gnu/usr.bin/binutils/gdb/m88k-tdep.c index 70378080208..695b9a3d380 100644 --- a/gnu/usr.bin/binutils/gdb/m88k-tdep.c +++ b/gnu/usr.bin/binutils/gdb/m88k-tdep.c @@ -879,6 +879,10 @@ m88k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_write_pc (gdbarch, m88k_write_pc); frame_base_set_default (gdbarch, &m88k_frame_base); + + /* Hook in ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch); + frame_unwind_append_sniffer (gdbarch, m88k_frame_sniffer); return gdbarch; diff --git a/gnu/usr.bin/binutils/gdb/m88kbsd-tdep.c b/gnu/usr.bin/binutils/gdb/m88kbsd-tdep.c new file mode 100644 index 00000000000..9c6009dca93 --- /dev/null +++ b/gnu/usr.bin/binutils/gdb/m88kbsd-tdep.c @@ -0,0 +1,78 @@ +/* Target-dependent code for Motorola 88000 BSD's. + + Copyright 2004 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include "defs.h" +#include "arch-utils.h" +#include "osabi.h" + +#include "m88k-tdep.h" +#include "symtab.h" +#include "symfile.h" +#include "objfiles.h" +#include "solib-svr4.h" + +/* OpenBSD ELF. */ + +static void +m88kbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + /* OpenBSD ELF uses SVR4-style shared libraries. */ + set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); +} + + +static enum gdb_osabi +m88kbsd_aout_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "a.out-m88k-openbsd") == 0) + return GDB_OSABI_NETBSD_AOUT; + + return GDB_OSABI_UNKNOWN; +} + +static enum gdb_osabi +m88kbsd_core_osabi_sniffer (bfd *abfd) +{ + if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0) + return GDB_OSABI_NETBSD_AOUT; + + return GDB_OSABI_UNKNOWN; +} + + +/* Provide a prototype to silence -Wmissing-prototypes. */ +void _initialize_m88kbsd_tdep (void); + +void +_initialize_m88kbsd_tdep (void) +{ + gdbarch_register_osabi_sniffer (bfd_arch_m88k, bfd_target_aout_flavour, + m88kbsd_aout_osabi_sniffer); + + /* BFD doesn't set a flavour for NetBSD style a.out core files. */ + gdbarch_register_osabi_sniffer (bfd_arch_m88k, bfd_target_unknown_flavour, + m88kbsd_core_osabi_sniffer); + + gdbarch_register_osabi (bfd_arch_m88k, 0, GDB_OSABI_OPENBSD_ELF, + m88kbsd_elf_init_abi); +} |