From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22056 invoked by alias); 21 Dec 2002 05:12:28 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22026 invoked from network); 21 Dec 2002 05:12:26 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 21 Dec 2002 05:12:26 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id gBL4jmi15103 for ; Fri, 20 Dec 2002 23:45:48 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gBL5CE223421 for ; Sat, 21 Dec 2002 00:12:14 -0500 Received: from localhost.localdomain (vpn50-3.rdu.redhat.com [172.16.50.3]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id gBL5CEL09746 for ; Sat, 21 Dec 2002 00:12:14 -0500 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id gBL5C8c12082 for gdb-patches@sources.redhat.com; Fri, 20 Dec 2002 22:12:08 -0700 Date: Fri, 20 Dec 2002 22:39:00 -0000 From: Kevin Buettner Message-Id: <1021221051208.ZM12081@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [PATCH] MIPS/Linux: Multiarch SVR4_FETCH_LINK_MAP_OFFSETS, GET_LONGJMP_TARGET MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-12/txt/msg00601.txt.bz2 On the theory that multiarch work is "obvious", I've committed the patch below. * Makefile.in (mips-linux-tdep.o): Add $(osabi_h) and $(gdb_string_h). * config/mips/tm-linux.h (mips_linux_svr4_fetch_link_map_offsets) (mips_linux_get_longjmp_target): Delete declarations. (SVR4_FETCH_LINK_MAP_OFFSETS, GET_LONGJMP_TARGET) (MIPS_LINUX_JB_ELEMENT_SIZE, MIPS_LINUX_JB_PC): Delete definitions. * mips-linux-tdep.c (osabi.h, gdb_string.h): Include. (MIPS_LINUX_JB_ELEMENT_SIZE, MIPS_LINUX_JB_PC): Define. (mips_linux_get_longjmp_target) (mips_linux_svr4_fetch_link_map_offsets): Make static. (mips_linux_init_abi): New function. (_initialize_mips_linux_tdep): Register mips_linux_init_abi(). Index: Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/Makefile.in,v retrieving revision 1.296 diff -u -p -r1.296 Makefile.in --- Makefile.in 16 Dec 2002 16:51:45 -0000 1.296 +++ Makefile.in 21 Dec 2002 05:01:39 -0000 @@ -1946,7 +1946,7 @@ minsyms.o: minsyms.c $(defs_h) $(gdb_str mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h) mips-linux-nat.o: mips-linux-nat.c $(defs_h) mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \ - $(solib_svr4_h) + $(solib_svr4_h) $(osabi_h) $(gdb_string_h) mips-nat.o: mips-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(regcache_h) mips-tdep.o: mips-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \ $(symtab_h) $(value_h) $(gdbcmd_h) $(language_h) $(gdbcore_h) \ Index: mips-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v retrieving revision 1.6 diff -u -p -r1.6 mips-linux-tdep.c --- mips-linux-tdep.c 14 Nov 2002 20:37:28 -0000 1.6 +++ mips-linux-tdep.c 21 Dec 2002 05:01:39 -0000 @@ -23,6 +23,8 @@ #include "gdbcore.h" #include "target.h" #include "solib-svr4.h" +#include "osabi.h" +#include "gdb_string.h" /* Copied from . */ #define ELF_NGREG 45 @@ -60,7 +62,10 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_N which we extract the pc (MIPS_LINUX_JB_PC) that we will land at. The pc is copied into PC. This routine returns 1 on success. */ -int +#define MIPS_LINUX_JB_ELEMENT_SIZE 4 +#define MIPS_LINUX_JB_PC 0 + +static int mips_linux_get_longjmp_target (CORE_ADDR *pc) { CORE_ADDR jb_addr; @@ -309,7 +314,7 @@ static struct core_fns regset_core_fns = This makes it possible to access GNU/Linux MIPS shared libraries from a GDB that was built on a different host platform (for cross debugging). */ -struct link_map_offsets * +static struct link_map_offsets * mips_linux_svr4_fetch_link_map_offsets (void) { static struct link_map_offsets lmo; @@ -342,8 +347,18 @@ mips_linux_svr4_fetch_link_map_offsets ( return lmp; } +static void +mips_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, mips_linux_svr4_fetch_link_map_offsets); +} + void _initialize_mips_linux_tdep (void) { + gdbarch_register_osabi (bfd_arch_mips, GDB_OSABI_LINUX, + mips_linux_init_abi); add_core_fns (®set_core_fns); } Index: config/mips/tm-linux.h =================================================================== RCS file: /cvs/src/src/gdb/config/mips/tm-linux.h,v retrieving revision 1.6 diff -u -p -r1.6 tm-linux.h --- config/mips/tm-linux.h 20 Aug 2002 13:17:55 -0000 1.6 +++ config/mips/tm-linux.h 21 Dec 2002 05:01:40 -0000 @@ -40,25 +40,6 @@ #include "config/tm-linux.h" -/* Use target_specific function to define link map offsets. */ - -extern struct link_map_offsets *mips_linux_svr4_fetch_link_map_offsets (void); -#define SVR4_FETCH_LINK_MAP_OFFSETS() \ - mips_linux_svr4_fetch_link_map_offsets () - -/* Details about jmp_buf. */ - -#define MIPS_LINUX_JB_ELEMENT_SIZE 4 -#define MIPS_LINUX_JB_PC 0 - -/* Figure out where the longjmp will land. Slurp the arguments out of the - stack. We expect the first arg to be a pointer to the jmp_buf structure - from which we extract the pc (JB_PC) that we will land at. The pc is - copied into ADDR. This routine returns 1 on success. */ - -#define GET_LONGJMP_TARGET(ADDR) mips_linux_get_longjmp_target(ADDR) -extern int mips_linux_get_longjmp_target (CORE_ADDR *); - /* We do single stepping in software. */ #define SOFTWARE_SINGLE_STEP_P() 1