From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: gdb-patches@sources.redhat.com Subject: [PATCH RFC] arm-tdep.c: Define SVR4 link map offset fetcher Date: Tue, 27 Nov 2001 13:43:00 -0000 Message-ID: <1011127214311.ZM12873@ocotillo.lan> X-SW-Source: 2001-11/msg00511.html Message-ID: <20011127134300.i3SgIFDOUNG7mkkhBdLCnNpzYkXoD9B-6h5tv8NdGwE@z> The patch below adds shared library support for non-native ARM linux targets. I'll wait a few days for comments before committing it. Kevin From Louis Hamilton : * arm-tdep.c (solib-svr4.h): Include. (arm_linux_svr4_fetch_link_map_offsets): New function. * config/arm/tm-linux.h (SVR4_FETCH_LINK_MAP_OFFSETS): Define. (arm_linux_svr4_fetch_link_map_offsets): Declare. Index: arm-tdep.c =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/arm-tdep.c,v retrieving revision 1.65.8.1.2.1 diff -u -p -r1.65.8.1.2.1 arm-tdep.c --- arm-tdep.c 2001/10/02 15:53:35 1.65.8.1.2.1 +++ arm-tdep.c 2001/11/27 18:42:10 @@ -31,6 +31,7 @@ #include /* for isupper () */ #include "regcache.h" #include "doublest.h" +#include "solib-svr4.h" /* Each OS has a different mechanism for accessing the various registers stored in the sigcontext structure. @@ -2094,6 +2101,49 @@ arm_othernames (char *names, int n) disassembly_flavor = valid_flavors[current_option]; set_disassembly_flavor (); +} + +/* Fetch, and possibly build, an appropriate link_map_offsets structure + for ARM linux targets using the struct offsets defined in . + Note, however, that link.h is not actually referred to in this file. + Instead, the relevant structs offsets were obtained from examining + link.h. (We can't refer to link.h from this file because the host + system won't necessarily have it, or if it does, the structs which + it defines will refer to the host system, not the target. */ + +struct link_map_offsets * +arm_linux_svr4_fetch_link_map_offsets (void) +{ + static struct link_map_offsets lmo; + static struct link_map_offsets *lmp = 0; + + if (lmp == 0) + { + lmp = &lmo; + + lmo.r_debug_size = 8; /* Actual size is 20, but this is all we + need. */ + + lmo.r_map_offset = 4; + lmo.r_map_size = 4; + + lmo.link_map_size = 20; /* Actual size is 552, 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; } void Index: config/arm/tm-linux.h =================================================================== RCS file: /cvs/cvsfiles/devo/gdb/config/arm/tm-linux.h,v retrieving revision 1.5 diff -u -p -r1.5 tm-linux.h --- config/arm/tm-linux.h 2000/09/07 12:34:17 1.5 +++ config/arm/tm-linux.h 2001/11/27 18:42:11 @@ -26,6 +26,10 @@ #include "tm-linux.h" +/* Use target-specific function to define link map offsets. */ +extern struct link_map_offsets *arm_linux_svr4_fetch_link_map_offsets (void); +#define SVR4_FETCH_LINK_MAP_OFFSETS() arm_linux_svr4_fetch_link_map_offsets () + /* Target byte order on ARM Linux is little endian and not selectable. */ #undef TARGET_BYTE_ORDER_SELECTABLE_P #define TARGET_BYTE_ORDER_SELECTABLE_P 0