gdb/
[deliverable/binutils-gdb.git] / gdb / i386-nto-tdep.c
index 19729b6dea2fe51843dbbfb2e4d254ab1c5e9de7..ede9bf13f10445804b227222f72ef11cb4fe75a2 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for QNX Neutrino x86.
 
-   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
 
    Contributed by QNX Software Systems Ltd.
 
@@ -31,6 +31,7 @@
 #include "i386-tdep.h"
 #include "i387-tdep.h"
 #include "nto-tdep.h"
+#include "solib.h"
 #include "solib-svr4.h"
 
 /* Target vector for QNX NTO x86.  */
@@ -130,7 +131,8 @@ i386nto_regset_id (int regno)
 }
 
 static int
-i386nto_register_area (int regno, int regset, unsigned *off)
+i386nto_register_area (struct gdbarch *gdbarch,
+                      int regno, int regset, unsigned *off)
 {
   int len;
 
@@ -165,8 +167,7 @@ i386nto_register_area (int regno, int regset, unsigned *off)
       if (regno == -1)
        return regset_size;
 
-      *off = (regno - gdbarch_fp0_regnum (current_gdbarch))
-            * regsize + off_adjust;
+      *off = (regno - gdbarch_fp0_regnum (gdbarch)) * regsize + off_adjust;
       return 10;
       /* Why 10 instead of regsize?  GDB only stores 10 bytes per FP
          register so if we're sending a register back to the target,
@@ -203,13 +204,13 @@ i386nto_regset_fill (const struct regcache *regcache, int regset, char *data)
   return 0;
 }
 
-/* Return whether the frame preceding NEXT_FRAME corresponds to a QNX
-   Neutrino sigtramp routine.  */
+/* Return whether THIS_FRAME corresponds to a QNX Neutrino sigtramp
+   routine.  */
 
 static int
-i386nto_sigtramp_p (struct frame_info *next_frame)
+i386nto_sigtramp_p (struct frame_info *this_frame)
 {
-  CORE_ADDR pc = frame_pc_unwind (next_frame);
+  CORE_ADDR pc = get_frame_pc (this_frame);
   char *name;
 
   find_pc_partial_function (pc, &name, NULL, NULL);
@@ -218,16 +219,16 @@ i386nto_sigtramp_p (struct frame_info *next_frame)
 
 #define I386_NTO_SIGCONTEXT_OFFSET 136
 
-/* Assuming NEXT_FRAME is a frame following a QNX Neutrino sigtramp
-   routine, return the address of the associated sigcontext structure.  */
+/* Assuming THIS_FRAME is a QNX Neutrino sigtramp routine, return the
+   address of the associated sigcontext structure.  */
 
 static CORE_ADDR
-i386nto_sigcontext_addr (struct frame_info *next_frame)
+i386nto_sigcontext_addr (struct frame_info *this_frame)
 {
   char buf[4];
   CORE_ADDR sp;
 
-  frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
+  get_frame_register (this_frame, I386_ESP_REGNUM, buf);
   sp = extract_unsigned_integer (buf, 4);
 
   return sp + I386_NTO_SIGCONTEXT_OFFSET;
@@ -251,6 +252,7 @@ static void
 i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+  static struct target_so_ops nto_svr4_so_ops;
 
   /* Deal with our strange signals.  */
   nto_initialize_signals ();
@@ -277,14 +279,25 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_ilp32_fetch_link_map_offsets);
 
-  /* Our loader handles solib relocations slightly differently than svr4.  */
-  TARGET_SO_RELOCATE_SECTION_ADDRESSES = nto_relocate_section_addresses;
+  /* Initialize this lazily, to avoid an initialization order
+     dependency on solib-svr4.c's _initialize routine.  */
+  if (nto_svr4_so_ops.in_dynsym_resolve_code == NULL)
+    {
+      nto_svr4_so_ops = svr4_so_ops;
+
+      /* Our loader handles solib relocations differently than svr4.  */
+      nto_svr4_so_ops.relocate_section_addresses
+        = nto_relocate_section_addresses;
 
-  /* Supply a nice function to find our solibs.  */
-  TARGET_SO_FIND_AND_OPEN_SOLIB = nto_find_and_open_solib;
+      /* Supply a nice function to find our solibs.  */
+      nto_svr4_so_ops.find_and_open_solib
+        = nto_find_and_open_solib;
 
-  /* Our linker code is in libc.  */
-  TARGET_SO_IN_DYNSYM_RESOLVE_CODE = nto_in_dynsym_resolve_code;
+      /* Our linker code is in libc.  */
+      nto_svr4_so_ops.in_dynsym_resolve_code
+        = nto_in_dynsym_resolve_code;
+    }
+  set_solib_ops (gdbarch, &nto_svr4_so_ops);
 
   nto_set_target (&i386_nto_target);
 }
This page took 0.025197 seconds and 4 git commands to generate.