From ea5bc2a6064698fb3a18f816e1d8f11baa74180a Mon Sep 17 00:00:00 2001 From: Jason Thorpe Date: Sat, 11 May 2002 22:14:19 +0000 Subject: [PATCH] * Makefile.in (ALLDEPFILES): Add nbsd-tdep.c. (alphanbsd-tdep.o): Add nbsd-tdep.h to dependency list. (nbsd-tdep.o): New dependency list. * alphanbsd-tdep.c: Don't include solib-svr4.h. Include nbsd-tdep.h. (alphanbsd_solib_svr4_fetch_link_map_offsets): Remove. (alphanbsd_init_abi): Use nbsd_lp64_solib_svr4_fetch_link_map_offsets. * nbsd-tdep.c: New file. * nbsd-tdep.h: New file. * shnbsd-tdep.c: Don't include solib-svr4.h. Include nbsd-tdep.h. (shnbsd_solib_svr4_fetch_link_map_offsets): Remove. (shnbsd_init_abi): Use nbsd_ilp32_solib_svr4_fetch_link_map_offsets. * config/alpha/nbsd.mt (TDEPFILES): Add nbsd-tdep.o. * config/sh/nbsd.mt (TDEPFILES): Ditto. --- gdb/ChangeLog | 18 ++++++++ gdb/Makefile.in | 5 +- gdb/alphanbsd-tdep.c | 45 +----------------- gdb/config/alpha/nbsd.mt | 2 +- gdb/config/sh/nbsd.mt | 2 +- gdb/nbsd-tdep.c | 99 ++++++++++++++++++++++++++++++++++++++++ gdb/nbsd-tdep.h | 28 ++++++++++++ gdb/shnbsd-tdep.c | 45 +----------------- 8 files changed, 155 insertions(+), 89 deletions(-) create mode 100644 gdb/nbsd-tdep.c create mode 100644 gdb/nbsd-tdep.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8ac3663280..f3f668a895 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2002-05-11 Jason Thorpe + + * Makefile.in (ALLDEPFILES): Add nbsd-tdep.c. + (alphanbsd-tdep.o): Add nbsd-tdep.h to dependency list. + (nbsd-tdep.o): New dependency list. + * alphanbsd-tdep.c: Don't include solib-svr4.h. Include + nbsd-tdep.h. + (alphanbsd_solib_svr4_fetch_link_map_offsets): Remove. + (alphanbsd_init_abi): Use nbsd_lp64_solib_svr4_fetch_link_map_offsets. + * nbsd-tdep.c: New file. + * nbsd-tdep.h: New file. + * shnbsd-tdep.c: Don't include solib-svr4.h. Include + nbsd-tdep.h. + (shnbsd_solib_svr4_fetch_link_map_offsets): Remove. + (shnbsd_init_abi): Use nbsd_ilp32_solib_svr4_fetch_link_map_offsets. + * config/alpha/nbsd.mt (TDEPFILES): Add nbsd-tdep.o. + * config/sh/nbsd.mt (TDEPFILES): Ditto. + 2002-05-11 Jason Thorpe * config/alpha/nbsd.mh (NATDEPFILES): Remove corelow.o. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index cb9efcff2d..00f809c6fc 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1205,6 +1205,7 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \ mips-linux-nat.c mips-linux-tdep.c \ mips-nat.c \ mips-tdep.c mipsm3-nat.c mipsv4-nat.c \ + nbsd-tdep.c \ nindy-share/Onindy.c nindy-share/nindy.c \ nindy-share/ttyflush.c nindy-tdep.c \ ns32k-tdep.c solib-osf.c \ @@ -1261,7 +1262,7 @@ alphabsd-tdep.o: alphabsd-tdep.c $(defs_h) $(regcache_h) alphabsd-tdep.h alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) alpha-tdep.h alphanbsd-tdep.o: alphanbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \ - $(value_h) alpha-tdep.h alphabsd-tdep.h + $(value_h) alpha-tdep.h alphabsd-tdep.h nbsd-tdep.h annotate.o: annotate.c $(defs_h) $(annotate_h) $(value_h) $(target_h) $(gdbtypes_h) @@ -1799,6 +1800,8 @@ monitor.o: monitor.c $(monitor_h) $(bfd_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(gdb_string_h) \ $(regcache_h) +nbsd-tdep.o: nbsd-tdep.c $(defs_h) solib-svr4.h + Onindy.o: nindy-share/Onindy.c gdb_wait.h nindy-share/block_io.h \ nindy-share/env.h $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/nindy-share/Onindy.c diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c index 65641ec975..d10a3cab15 100644 --- a/gdb/alphanbsd-tdep.c +++ b/gdb/alphanbsd-tdep.c @@ -23,10 +23,10 @@ #include "gdbcore.h" #include "regcache.h" #include "value.h" -#include "solib-svr4.h" #include "alpha-tdep.h" #include "alphabsd-tdep.h" +#include "nbsd-tdep.h" static void fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, @@ -117,47 +117,6 @@ static struct core_fns alphanbsd_elfcore_fns = NULL /* next */ }; -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for NetBSD/alpha targets using the struct offsets - defined in (but without actual reference to that file). - - This makes it possible to access NetBSD/alpha shared libraries - from a GDB that was not built on a NetBSD/alpha host (for cross - debugging). */ - -static struct link_map_offsets * -alphanbsd_solib_svr4_fetch_link_map_offsets (void) -{ - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = NULL; - - if (lmp == NULL) - { - lmp = &lmo; - - lmo.r_debug_size = 32; - - lmo.r_map_offset = 8; - lmo.r_map_size = 8; - - lmo.link_map_size = 40; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 8; - - lmo.l_name_offset = 8; - lmo.l_name_size = 8; - - lmo.l_next_offset = 24; - lmo.l_next_size = 8; - - lmo.l_prev_offset = 32; - lmo.l_prev_size = 8; - } - - return lmp; -} - /* Under NetBSD/alpha, signal handler invocations can be identified by the designated code sequence that is used to return from a signal handler. In particular, the return address of a signal handler points to the @@ -233,7 +192,7 @@ alphanbsd_init_abi (struct gdbarch_info info, set_gdbarch_software_single_step (gdbarch, alpha_software_single_step); set_solib_svr4_fetch_link_map_offsets (gdbarch, - alphanbsd_solib_svr4_fetch_link_map_offsets); + nbsd_lp64_solib_svr4_fetch_link_map_offsets); tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset; diff --git a/gdb/config/alpha/nbsd.mt b/gdb/config/alpha/nbsd.mt index f7808f0079..7fd9c50325 100644 --- a/gdb/config/alpha/nbsd.mt +++ b/gdb/config/alpha/nbsd.mt @@ -1,4 +1,4 @@ # Target: Alpha running NetBSD TDEPFILES= alpha-tdep.o alphabsd-tdep.o alphanbsd-tdep.o corelow.o \ - solib.o solib-svr4.o + nbsd-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h diff --git a/gdb/config/sh/nbsd.mt b/gdb/config/sh/nbsd.mt index b440993724..62d0c5ce3e 100644 --- a/gdb/config/sh/nbsd.mt +++ b/gdb/config/sh/nbsd.mt @@ -1,5 +1,5 @@ # Target: SuperH running NetBSD -TDEPFILES= sh-tdep.o shnbsd-tdep.o corelow.o solib.o solib-svr4.o +TDEPFILES= sh-tdep.o shnbsd-tdep.o corelow.o nbsd-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h SIM_OBS = remote-sim.o diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c new file mode 100644 index 0000000000..b5cdffb936 --- /dev/null +++ b/gdb/nbsd-tdep.c @@ -0,0 +1,99 @@ +/* Common target-dependent code for NetBSD systems. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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 "solib-svr4.h" + +/* Fetch (and possibly build) an appropriate link_map_offsets + structure for NetBSD/sh targets using the struct offsets + defined in (but without actual reference to that file). + + This makes it possible to access NetBSD/sh shared libraries + from a GDB that was not built on a NetBSD/sh host (for cross + debugging). + + We provide versions for ILP32 and LP64 NetBSD targets here. */ + +struct link_map_offsets * +nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 16; + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 20; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 4; + + lmo.l_name_offset = 4; + lmo.l_name_size = 4; + + lmo.l_next_offset = 12; + lmo.l_next_size = 4; + + lmo.l_prev_offset = 16; + lmo.l_prev_size = 4; + } + + return lmp; +} + +struct link_map_offsets * +nbsd_lp64_solib_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = NULL; + + if (lmp == NULL) + { + lmp = &lmo; + + lmo.r_debug_size = 32; + + lmo.r_map_offset = 8; + lmo.r_map_size = 8; + + lmo.link_map_size = 40; + + lmo.l_addr_offset = 0; + lmo.l_addr_size = 8; + + lmo.l_name_offset = 8; + lmo.l_name_size = 8; + + lmo.l_next_offset = 24; + lmo.l_next_size = 8; + + lmo.l_prev_offset = 32; + lmo.l_prev_size = 8; + } + + return lmp; +} diff --git a/gdb/nbsd-tdep.h b/gdb/nbsd-tdep.h new file mode 100644 index 0000000000..ca40965184 --- /dev/null +++ b/gdb/nbsd-tdep.h @@ -0,0 +1,28 @@ +/* Common target-dependent definitions for NetBSD systems. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Wasabi Systems, 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. */ + +#ifndef NBSD_TDEP_H +#define NBSD_TDEP_H + +struct link_map_offsets *nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void); +struct link_map_offsets *nbsd_lp64_solib_svr4_fetch_link_map_offsets (void); + +#endif /* NBSD_TDEP_H */ diff --git a/gdb/shnbsd-tdep.c b/gdb/shnbsd-tdep.c index 8e503860f0..5f9903d8d7 100644 --- a/gdb/shnbsd-tdep.c +++ b/gdb/shnbsd-tdep.c @@ -23,8 +23,8 @@ #include "gdbcore.h" #include "regcache.h" #include "value.h" -#include "solib-svr4.h" +#include "nbsd-tdep.h" #include "shnbsd-tdep.h" /* Convert an r0-r15 register number into an offset into a ptrace @@ -107,47 +107,6 @@ shnbsd_fill_reg (char *regs, int regno) } } -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for NetBSD/sh targets using the struct offsets - defined in (but without actual reference to that file). - - This makes it possible to access NetBSD/sh shared libraries - from a GDB that was not built on a NetBSD/sh host (for cross - debugging). */ - -static struct link_map_offsets * -shnbsd_solib_svr4_fetch_link_map_offsets (void) -{ - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = NULL; - - if (lmp == NULL) - { - lmp = &lmo; - - lmo.r_debug_size = 16; - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - static void fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, CORE_ADDR ignore) @@ -208,7 +167,7 @@ shnbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { set_solib_svr4_fetch_link_map_offsets (gdbarch, - shnbsd_solib_svr4_fetch_link_map_offsets); + nbsd_ilp32_solib_svr4_fetch_link_map_offsets); } void -- 2.34.1