From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13646 invoked by alias); 27 Nov 2001 21:43:34 -0000 Mailing-List: contact gdb-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13380 invoked from network); 27 Nov 2001 21:43:30 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by hostedprojects.ges.redhat.com with SMTP; 27 Nov 2001 21:43:30 -0000 Received: from cse.cygnus.com (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id NAA19105 for ; Tue, 27 Nov 2001 13:43:28 -0800 (PST) Received: (from kev@localhost) by cse.cygnus.com (8.9.3/8.9.3) id OAA12874 for gdb-patches@sources.redhat.com; Tue, 27 Nov 2001 14:43:11 -0700 Date: Wed, 14 Nov 2001 22:52:00 -0000 From: Kevin Buettner Message-Id: <1011127214311.ZM12873@ocotillo.lan> X-Mailer: Z-Mail (4.0.1 13Jan97 Caldera) To: gdb-patches@sources.redhat.com Subject: [PATCH RFC] arm-tdep.c: Define SVR4 link map offset fetcher MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2001-11/txt/msg00296.txt.bz2 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 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