/* Target-dependent code for QNX Neutrino x86.
- Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
Contributed by QNX Software Systems Ltd.
#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. */
static void
i386nto_supply_gregset (struct regcache *regcache, char *gpregs)
{
- struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if(tdep->gregset == NULL)
- tdep->gregset = regset_alloc (current_gdbarch, i386_supply_gregset,
+ tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
i386_collect_gregset);
gdb_assert (tdep->gregset_reg_offset == i386nto_gregset_reg_offset);
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);
#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;
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 ();
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);
}