/* 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.
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"
#include "elf-bfd.h"
#include "solib-svr4.h"
#include "gdbcore.h"
+#include "objfiles.h"
+
+#include <string.h>
#ifdef __CYGWIN__
#include <sys/cygwin.h>
}
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;
#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)
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);
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 *
}
void
-nto_dummy_supply_regset (char *regs)
+nto_dummy_supply_regset (struct regcache *regcache, char *regs)
{
/* Do nothing. */
}
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 *) ®set, core_reg_sect,
- min (core_reg_size, sizeof (regset)));
- nto_supply_gregset ((char *) ®set);
- }
- else if (which == 2)
- {
- memcpy ((char *) ®set, core_reg_sect,
- min (core_reg_size, sizeof (regset)));
- nto_supply_fpregset ((char *) ®set);
- }
-}
-
-/* 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)
{
_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 (®set_core_fns);
+for different positive values."),
+ NULL,
+ NULL, /* FIXME: i18n: QNX NTO internal debugging is %s. */
+ &setdebuglist, &showdebuglist);
}