OSDN Git Service

2000-10-30 Michael Snyder <msnyder@cleaver.cygnus.com>
authormsnyder <msnyder>
Tue, 31 Oct 2000 19:35:03 +0000 (19:35 +0000)
committermsnyder <msnyder>
Tue, 31 Oct 2000 19:35:03 +0000 (19:35 +0000)
* config/sh/tm-linux.h: New file.  Include generic tm-linux.h,
plus tm-sh.h, then define SVR4_FETCH_LINK_MAP_OFFSETS to use
the sh target function instead of the default link map offsets.
* config/sh/sh.mt: Add solib.o and solib-svr4.o to TDEPFILES.
Use sh/tm-linux.h instead of sh/tm-sh.h.
* sh-tdep.c (sh_linux_svr4_fetch_link_map_offsets):
New function.  Construct target-specific link map offsets.
* i386-linux-tdep.c (i386_linux_svr4_fetch_link_map_offsets:
New function.  Construct target-specific link map offsets.
* config/i386/tm-linux.h: Use above function instead of default.

2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>

* config/i386/tm-linux.h: Remove definition of SVR4_SHARED_LIBS,
and inclusion of solib.h.  Move up into ../tm-linux.h.
config/tm-linux.h: Define SVR4_SHARED_LIBS, include solib.h.

gdb/ChangeLog
gdb/config/i386/tm-linux.h
gdb/config/sh/sh.mt
gdb/config/sh/tm-linux.h [new file with mode: 0644]
gdb/config/tm-linux.h
gdb/i386-linux-tdep.c
gdb/sh-tdep.c

index 4cbd596..ae47682 100644 (file)
@@ -1,3 +1,22 @@
+2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+       * config/sh/tm-linux.h: New file.  Include generic tm-linux.h, 
+       plus tm-sh.h, then define SVR4_FETCH_LINK_MAP_OFFSETS to use
+       the sh target function instead of the default link map offsets.
+       * config/sh/sh.mt: Add solib.o and solib-svr4.o to TDEPFILES.
+       Use sh/tm-linux.h instead of sh/tm-sh.h.
+       * sh-tdep.c (sh_linux_svr4_fetch_link_map_offsets): 
+       New function.  Construct target-specific link map offsets.
+       * i386-linux-tdep.c (i386_linux_svr4_fetch_link_map_offsets:
+       New function.  Construct target-specific link map offsets.
+       * config/i386/tm-linux.h: Use above function instead of default.
+
+2000-10-30  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+       * config/i386/tm-linux.h: Remove definition of SVR4_SHARED_LIBS,
+       and inclusion of solib.h.  Move up into ../tm-linux.h.
+       config/tm-linux.h: Define SVR4_SHARED_LIBS, include solib.h.
+
 2000-10-30  Kevin Buettner  <kevinb@redhat.com>
 
        * top.c (simplified_command_loop, add_info, add_com,
index f781e78..a707a03 100644 (file)
 #include "i386/tm-i386.h"
 #include "tm-linux.h"
 
+/* Use target_specific function to define link map offsets.  */
+extern struct link_map_offsets *i386_linux_svr4_fetch_link_map_offsets (void);
+#define SVR4_FETCH_LINK_MAP_OFFSETS() i386_linux_svr4_fetch_link_map_offsets ()
+
 /* FIXME: kettenis/2000-03-26: We should get rid of this last piece of
    Linux-specific `long double'-support code, probably by adding code
    to valprint.c:print_floating() to recognize various extended
index a6604d4..25540b3 100644 (file)
@@ -1,6 +1,6 @@
 # Target: Hitachi Super-H with ICE and simulator
-TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o
-TM_FILE= tm-sh.h
+TDEPFILES= sh-tdep.o monitor.o sh3-rom.o remote-e7000.o ser-e7kpc.o dsrec.o solib.o solib-svr4.o
+TM_FILE= tm-linux.h
 
 SIM_OBS = remote-sim.o
 SIM = ../sim/sh/libsim.a
diff --git a/gdb/config/sh/tm-linux.h b/gdb/config/sh/tm-linux.h
new file mode 100644 (file)
index 0000000..bf9a384
--- /dev/null
@@ -0,0 +1,30 @@
+/* Target-specific definitions for Linux running on a Hitachi Super-H.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* Pull in Linux generic defs */
+#include "tm-linux.h"
+
+/* Pull in sh-target defs */
+#include "sh/tm-sh.h"
+
+/* Use target_specific function to define link map offsets.  */
+extern struct link_map_offsets *sh_linux_svr4_fetch_link_map_offsets (void);
+#define SVR4_FETCH_LINK_MAP_OFFSETS() sh_linux_svr4_fetch_link_map_offsets ()
+
index d1040ac..0b4db5a 100644 (file)
 /* We need this file for the SOLIB_TRAMPOLINE stuff. */
 
 #include "tm-sysv4.h"
+
+/* We define SVR4_SHARED_LIBS unconditionally, on the assumption that
+   link.h is available on all linux platforms.  For I386 and SH3/4, 
+   we hard-code the information rather than use link.h anyway (for 
+   the benefit of cross-debugging).  We may move to doing that for
+   other architectures as well.  */
+
+#define SVR4_SHARED_LIBS
+#include "solib.h"             /* Support for shared libraries. */
index c487959..e7fbc38 100644 (file)
@@ -27,6 +27,7 @@
 #include "symtab.h"
 #include "symfile.h"
 #include "objfiles.h"
+#include "solib-svr4.h"        /* for struct link_map_offsets */
 
 \f
 /* Recognizing signal handler frames.  */
@@ -372,3 +373,45 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc)
 
   return 0;
 }
+
+/* Fetch (and possibly build) an appropriate link_map_offsets structure
+   for native i386 linux targets using the struct offsets defined in
+   link.h (but without actual reference to that file).
+
+   This makes it possible to access i386-linux shared libraries from
+   a gdb that was not built on an i386-linux host (for cross debugging).
+   */
+
+struct link_map_offsets *
+i386_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;    /* 20 not actual size but all we need */
+
+      lmo.r_map_offset = 4;
+      lmo.r_map_size   = 4;
+
+      lmo.link_map_size = 20;  /* 552 not actual size but 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;
+}
+
index b2b4d2f..44c5bd8 100644 (file)
@@ -39,6 +39,8 @@
 #include "arch-utils.h"
 #include "floatformat.h"
 
+#include "solib-svr4.h"
+
 #undef XMALLOC
 #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
 
@@ -1798,6 +1800,50 @@ sh_do_registers_info (int regnum, int fpregs)
     }
 }
 
+#ifdef SVR4_SHARED_LIBS
+
+/* Fetch (and possibly build) an appropriate link_map_offsets structure
+   for native i386 linux targets using the struct offsets defined in
+   link.h (but without actual reference to that file).
+
+   This makes it possible to access i386-linux shared libraries from
+   a gdb that was not built on an i386-linux host (for cross debugging).
+   */
+
+struct link_map_offsets *
+sh_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;    /* 20 not actual size but all we need */
+
+      lmo.r_map_offset = 4;
+      lmo.r_map_size   = 4;
+
+      lmo.link_map_size = 20;  /* 552 not actual size but 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;
+}
+#endif /* SVR4_SHARED_LIBS */
+
 static gdbarch_init_ftype sh_gdbarch_init;
 
 static struct gdbarch *