* gdbarch.sh: Document the return_value method. Explain that
[deliverable/binutils-gdb.git] / gdb / nto-tdep.c
index 7cc1218b4027b0ca2c9f272a23b93a7ec0f42378..9abd28ccf22fc9e6e529e82efc3426fcd1384dc1 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, 2008 Free Software Foundation, Inc.
 
    Contributed by QNX Software Systems Ltd.
 
@@ -8,7 +8,7 @@
 
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
+#include "defs.h"
 #include "gdb_stat.h"
 #include "gdb_string.h"
 #include "nto-tdep.h"
@@ -33,6 +32,9 @@
 #include "elf-bfd.h"
 #include "solib-svr4.h"
 #include "gdbcore.h"
+#include "objfiles.h"
+
+#include <string.h>
 
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>
@@ -105,21 +107,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 +169,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);
@@ -257,20 +265,19 @@ LM_ADDR (struct so_list *so)
 {
   struct link_map_offsets *lmo = nto_fetch_link_map_offsets ();
 
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm +
-                                            lmo->l_addr_offset,
-                                            lmo->l_addr_size);
+  return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+                                builtin_type_void_data_ptr);
 }
 
 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 +343,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.  */
 }
@@ -376,11 +383,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);
+for different positive values."),
+                           NULL,
+                           NULL, /* FIXME: i18n: QNX NTO internal debugging is %s.  */
+                           &setdebuglist, &showdebuglist);
 }
This page took 0.038205 seconds and 4 git commands to generate.