2007-07-03 Paul Gilliam <pgilliam@us.ibm.com>
[deliverable/binutils-gdb.git] / gdb / nto-tdep.c
index b882a224b19e5218ec9fa2e020ea94b308a6e9fc..c7fd01751827ec8257d39651afa450bac3af5870 100644 (file)
@@ -1,6 +1,6 @@
 /* nto-tdep.c - general QNX Neutrino target functionality.
 
-   Copyright 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
 
    Contributed by QNX Software Systems Ltd.
 
@@ -18,8 +18,8 @@
 
    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.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "gdb_stat.h"
 #include "gdb_string.h"
@@ -33,6 +33,9 @@
 #include "elf-bfd.h"
 #include "solib-svr4.h"
 #include "gdbcore.h"
+#include "objfiles.h"
+
+#include <string.h>
 
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>
@@ -66,7 +69,7 @@ nto_target (void)
 }
 
 void
-nto_set_target(struct nto_target_ops *targ)
+nto_set_target (struct nto_target_ops *targ)
 {
   nto_regset_id = targ->regset_id;
   nto_supply_gregset = targ->supply_gregset;
@@ -105,21 +108,24 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
 #define PATH_FMT "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll"
 
   nto_root = nto_target ();
-  if (strcmp (TARGET_ARCHITECTURE->arch_name, "i386") == 0)
+  if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0
-          || strcmp (TARGET_ARCHITECTURE->arch_name, "powerpc") == 0)
+  else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+                  "rs6000") == 0
+          || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+                  "powerpc") == 0)
     {
       arch = "ppc";
       endian = "be";
     }
   else
     {
-      arch = TARGET_ARCHITECTURE->arch_name;
-      endian = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "be" : "le";
+      arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name;
+      endian = gdbarch_byte_order (current_gdbarch)
+              == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
   /* In case nto_root is short, add strlen(solib)
@@ -164,21 +170,24 @@ nto_init_solib_absolute_prefix (void)
   const char *arch;
 
   nto_root = nto_target ();
-  if (strcmp (TARGET_ARCHITECTURE->arch_name, "i386") == 0)
+  if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0)
     {
       arch = "x86";
       endian = "";
     }
-  else if (strcmp (TARGET_ARCHITECTURE->arch_name, "rs6000") == 0
-          || strcmp (TARGET_ARCHITECTURE->arch_name, "powerpc") == 0)
+  else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+                  "rs6000") == 0
+          || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name,
+                  "powerpc") == 0)
     {
       arch = "ppc";
       endian = "be";
     }
   else
     {
-      arch = TARGET_ARCHITECTURE->arch_name;
-      endian = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "be" : "le";
+      arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name;
+      endian = gdbarch_byte_order (current_gdbarch)
+              == BFD_ENDIAN_BIG ? "be" : "le";
     }
 
   sprintf (arch_path, "%s/%s%s", nto_root, arch, endian);
@@ -265,12 +274,12 @@ LM_ADDR (struct so_list *so)
 static CORE_ADDR
 nto_truncate_ptr (CORE_ADDR addr)
 {
-  if (TARGET_PTR_BIT == sizeof (CORE_ADDR) * 8)
+  if (gdbarch_ptr_bit (current_gdbarch) == sizeof (CORE_ADDR) * 8)
     /* We don't need to truncate anything, and the bit twiddling below
        will fail due to overflow problems.  */
     return addr;
   else
-    return addr & (((CORE_ADDR) 1 << TARGET_PTR_BIT) - 1);
+    return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_gdbarch)) - 1);
 }
 
 Elf_Internal_Phdr *
@@ -336,7 +345,7 @@ nto_generic_supply_altregset (const struct regset *regset,
 }
 
 void
-nto_dummy_supply_regset (char *regs)
+nto_dummy_supply_regset (struct regcache *regcache, char *regs)
 {
   /* Do nothing.  */
 }
@@ -345,41 +354,10 @@ enum gdb_osabi
 nto_elf_osabi_sniffer (bfd *abfd)
 {
   if (nto_is_nto_target)
-      return nto_is_nto_target (abfd);
+    return nto_is_nto_target (abfd);
   return GDB_OSABI_UNKNOWN;
 }
 
-static void
-fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
-                     int which, CORE_ADDR reg_addr)
-{
-  nto_regset_t regset;
-
-/* See corelow.c:get_core_registers for values of WHICH.  */
-  if (which == 0)
-    {
-      memcpy ((char *) &regset, core_reg_sect,
-             min (core_reg_size, sizeof (regset)));
-      nto_supply_gregset ((char *) &regset);
-    }
-  else if (which == 2)
-    {
-      memcpy ((char *) &regset, core_reg_sect,
-             min (core_reg_size, sizeof (regset)));
-      nto_supply_fpregset ((char *) &regset);
-    }
-}
-
-/* Register that we are able to handle ELF file formats using standard
-   procfs "regset" structures.  */
-static struct core_fns regset_core_fns = {
-  bfd_target_elf_flavour,      /* core_flavour */
-  default_check_format,                /* check_format */
-  default_core_sniffer,                /* core_sniffer */
-  fetch_core_registers,                /* core_read_registers */
-  NULL                         /* next */
-};
-
 void
 nto_initialize_signals (void)
 {
@@ -407,13 +385,13 @@ void
 _initialize_nto_tdep (void)
 {
   add_setshow_zinteger_cmd ("nto-debug", class_maintenance,
-                           &nto_internal_debugging, "\
-Set QNX NTO internal debugging.""\
-Show QNX NTO internal debugging.""\
+                           &nto_internal_debugging, _("\
+Set QNX NTO internal debugging."), _("\
+Show QNX NTO internal debugging."), _("\
 When non-zero, nto specific debug info is\n\
 displayed. Different information is displayed\n\
-for different positive values.", "\
-QNX NTO internal debugging is %s.", NULL, NULL, &setdebuglist, &showdebuglist);
-  /* Register core file support.  */
-  deprecated_add_core_fns (&regset_core_fns);
+for different positive values."),
+                           NULL,
+                           NULL, /* FIXME: i18n: QNX NTO internal debugging is %s.  */
+                           &setdebuglist, &showdebuglist);
 }
This page took 0.118267 seconds and 4 git commands to generate.