Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH RFC] arm-tdep.c: Define SVR4 link map offset fetcher
Date: Wed, 14 Nov 2001 22:52:00 -0000	[thread overview]
Message-ID: <1011127214311.ZM12873@ocotillo.lan> (raw)

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  <hamilton@redhat.com>:
	* 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 <ctype.h>		/* 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 <link.h>.
+   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


WARNING: multiple messages have this Message-ID
From: Kevin Buettner <kevinb@redhat.com>
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	[thread overview]
Message-ID: <1011127214311.ZM12873@ocotillo.lan> (raw)
Message-ID: <20011127134300.i3SgIFDOUNG7mkkhBdLCnNpzYkXoD9B-6h5tv8NdGwE@z> (raw)

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  <hamilton@redhat.com>:
	* 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 <ctype.h>		/* 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 <link.h>.
+   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


             reply	other threads:[~2001-11-27 21:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-14 22:52 Kevin Buettner [this message]
2001-11-14 23:19 ` Daniel Jacobowitz
2001-11-15  7:58   ` Kevin Buettner
2001-11-27 14:16     ` Kevin Buettner
2001-11-27 13:50   ` Daniel Jacobowitz
2001-11-23 12:39 ` Kevin Buettner
2001-11-30 12:29   ` Kevin Buettner
2001-11-27 13:43 ` Kevin Buettner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1011127214311.ZM12873@ocotillo.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox