From 6ded7999cda94104758893ee6cd00fe17d584ba2 Mon Sep 17 00:00:00 2001 From: Kevin Buettner Date: Sat, 1 Dec 2001 00:25:08 +0000 Subject: [PATCH] Add cross platform SVR4 shared library support for PowerPC. --- gdb/ChangeLog | 21 ++++++++++++++++ gdb/config/powerpc/aix.mt | 2 +- gdb/config/powerpc/macos.mt | 2 +- gdb/config/powerpc/nbsd.mt | 2 +- gdb/config/powerpc/ppc-eabi.mt | 2 +- gdb/config/powerpc/ppc-sim.mt | 2 +- gdb/config/powerpc/ppcle-eabi.mt | 2 +- gdb/config/powerpc/ppcle-sim.mt | 2 +- gdb/config/powerpc/vxworks.mt | 2 +- gdb/config/rs6000/aix4.mt | 2 +- gdb/config/rs6000/rs6000.mt | 2 +- gdb/config/rs6000/rs6000lynx.mt | 2 +- gdb/ppc-linux-tdep.c | 41 ++++++++++++++++++++++++++++++++ gdb/ppc-tdep.h | 1 + gdb/rs6000-tdep.c | 3 +++ 15 files changed, 77 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aa767ca1b1..3d6c370fd0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2001-11-30 Kevin Buettner + + * ppc-linux-tdep.c (solib-svr4.h): Include. + (ppc_linux_svr4_fetch_link_map_offsets): New function. + * ppc-tdep.h (ppc_linux_svr4_fetch_link_map_offsets): Declare. + * rs6000-tdep.c (solib-svr4.h): Include. + (rs6000_gdbarch_init): Set up ppc_linux_svr4_fetch_link_map_offsets() + as the link map offsets fetcher. + + * config/powerpc/aix.mt (TDEPFILES): Add solib-svr4.o. + * config/powerpc/macos.mt (TDEPFILES): Likewise. + * config/powerpc/nbsd.mt (TDEPFILES): Likewise. + * config/powerpc/ppc-eabi.mt (TDEPFILES): Likewise. + * config/powerpc/ppc-sim.mt (TDEPFILES): Likewise. + * config/powerpc/ppcle-eabi.mt (TDEPFILES): Likewise. + * config/powerpc/ppcle-sim.mt (TDEPFILES): Likewise. + * config/powerpc/vxworks.mt (TDEPFILES): Likewise. + * config/rs6000/aix4.mt (TDEPFILES): Likewise. + * config/rs6000/rs6000.mt (TDEPFILES): Likewise. + * config/rs6000/rs6000lynx.mt (TDEPFILES): Likewise. + 2001-11-30 Kevin Buettner From Louis Hamilton : diff --git a/gdb/config/powerpc/aix.mt b/gdb/config/powerpc/aix.mt index 985f71bd55..51bb625c77 100644 --- a/gdb/config/powerpc/aix.mt +++ b/gdb/config/powerpc/aix.mt @@ -1,3 +1,3 @@ # Target: PowerPC running AIX -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-aix.h diff --git a/gdb/config/powerpc/macos.mt b/gdb/config/powerpc/macos.mt index 061d9d612c..31a4fdf9d9 100644 --- a/gdb/config/powerpc/macos.mt +++ b/gdb/config/powerpc/macos.mt @@ -1,3 +1,3 @@ # Target: PowerMac (PowerPC running MacOS) -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-macos.h diff --git a/gdb/config/powerpc/nbsd.mt b/gdb/config/powerpc/nbsd.mt index acc5da804c..46e6541d8e 100644 --- a/gdb/config/powerpc/nbsd.mt +++ b/gdb/config/powerpc/nbsd.mt @@ -1,5 +1,5 @@ # Target: PowerPC, running NetBSD -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-nbsd.h GDBSERVER_DEPFILES= low-nbsd.o diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt index 2751e1d0ba..2d4a77fcde 100644 --- a/gdb/config/powerpc/ppc-eabi.mt +++ b/gdb/config/powerpc/ppc-eabi.mt @@ -1,3 +1,3 @@ # Target: PowerPC running eabi -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-eabi.h diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt index a647cadd9d..f2ad1f0b2c 100644 --- a/gdb/config/powerpc/ppc-sim.mt +++ b/gdb/config/powerpc/ppc-sim.mt @@ -1,5 +1,5 @@ # Target: PowerPC running eabi and including the simulator -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-bdm.o ocd.o remote-sds.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/ppcle-eabi.mt b/gdb/config/powerpc/ppcle-eabi.mt index 202c6b1c8f..e748097573 100644 --- a/gdb/config/powerpc/ppcle-eabi.mt +++ b/gdb/config/powerpc/ppcle-eabi.mt @@ -1,3 +1,3 @@ # Target: PowerPC running eabi in little endian mode -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppcle-eabi.h diff --git a/gdb/config/powerpc/ppcle-sim.mt b/gdb/config/powerpc/ppcle-sim.mt index e3be0d8d4f..558c0dc885 100644 --- a/gdb/config/powerpc/ppcle-sim.mt +++ b/gdb/config/powerpc/ppcle-sim.mt @@ -1,5 +1,5 @@ # Target: PowerPC running eabi in little endian mode under the simulator -TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o ppc-bdm.o ocd.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-ppcle-eabi.h SIM_OBS = remote-sim.o diff --git a/gdb/config/powerpc/vxworks.mt b/gdb/config/powerpc/vxworks.mt index 11d8ef2a8a..ba6e17bcb1 100644 --- a/gdb/config/powerpc/vxworks.mt +++ b/gdb/config/powerpc/vxworks.mt @@ -1,3 +1,3 @@ # Target: Powerpc running VxWorks -TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-vxworks.h diff --git a/gdb/config/rs6000/aix4.mt b/gdb/config/rs6000/aix4.mt index f1082b3a4b..fb9d0033fe 100644 --- a/gdb/config/rs6000/aix4.mt +++ b/gdb/config/rs6000/aix4.mt @@ -1,3 +1,3 @@ # Target: IBM RS/6000 running AIX4 -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000-aix4.h diff --git a/gdb/config/rs6000/rs6000.mt b/gdb/config/rs6000/rs6000.mt index a9afe89495..5ffcc0165a 100644 --- a/gdb/config/rs6000/rs6000.mt +++ b/gdb/config/rs6000/rs6000.mt @@ -1,3 +1,3 @@ # Target: IBM RS/6000 running AIX -TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o +TDEPFILES= rs6000-tdep.o xcoffread.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000.h diff --git a/gdb/config/rs6000/rs6000lynx.mt b/gdb/config/rs6000/rs6000lynx.mt index fae6d8c570..69aeb60c22 100644 --- a/gdb/config/rs6000/rs6000lynx.mt +++ b/gdb/config/rs6000/rs6000lynx.mt @@ -1,3 +1,3 @@ # Target: IBM RS6000 running LynxOS -TDEPFILES= coff-solib.o rs6000-tdep.o ppc-linux-tdep.o +TDEPFILES= coff-solib.o rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o TM_FILE= tm-rs6000ly.h diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 06fc2943d9..fb60385af3 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -32,6 +32,7 @@ #include "regcache.h" #include "value.h" +#include "solib-svr4.h" #include "ppc-tdep.h" /* The following two instructions are used in the signal trampoline @@ -763,3 +764,43 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) return val; } + +/* Fetch (and possibly build) an appropriate link_map_offsets + structure for Linux/PPC targets using the struct offsets + defined in link.h (but without actual reference to that file). + + This makes it possible to access Linux/PPC shared libraries from a + GDB that was not built on an Linux/PPC host (for cross debugging). */ + +struct link_map_offsets * +ppc_linux_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 = 8; /* The actual size is 20 bytes, but + this is all we need. */ + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 20; /* The actual size is 560 bytes, but + this is all we need. */ + 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; +} diff --git a/gdb/ppc-tdep.h b/gdb/ppc-tdep.h index e855223537..9ed1567c26 100644 --- a/gdb/ppc-tdep.h +++ b/gdb/ppc-tdep.h @@ -34,6 +34,7 @@ CORE_ADDR ppc_linux_frame_chain (struct frame_info *); CORE_ADDR ppc_sysv_abi_push_arguments (int, struct value **, CORE_ADDR, int, CORE_ADDR); int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache); +struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void); /* From rs6000-tdep.c... */ diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 12c6ed59b6..445007049a 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -40,6 +40,7 @@ #include "elf-bfd.h" +#include "solib-svr4.h" #include "ppc-tdep.h" /* If the kernel has to deliver a signal, it pushes a sigcontext @@ -2333,6 +2334,8 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_memory_remove_breakpoint (gdbarch, ppc_linux_memory_remove_breakpoint); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, ppc_linux_svr4_fetch_link_map_offsets); } else { -- 2.34.1