aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKris Warkentin <kewarken@qnx.com>2004-12-10 13:38:23 +0000
committerKris Warkentin <kewarken@qnx.com>2004-12-10 13:38:23 +0000
commitd737fd7f91e8282171e28b96156adbf8362293b8 (patch)
tree5ecc3c47500fdfa926bad38be76f3be8c753df73 /gdb
parent0e2cfdce255a722d3b3d3cdadf227e3110ef64f8 (diff)
downloadgdb-d737fd7f91e8282171e28b96156adbf8362293b8.zip
gdb-d737fd7f91e8282171e28b96156adbf8362293b8.tar.gz
gdb-d737fd7f91e8282171e28b96156adbf8362293b8.tar.bz2
* nto-tdep.h: Include osabi.h. Prototypes for generic Neutrino
osabi sniffer, signal handling initializer, 'in_dynsym_resolve_code' function and nto_set_target function. (struct nto_target_ops): Put comments inline with struct. Add osabi sniffer hook. Redefine macros to permit testing/assignment. Remove nto_ prefix from members. * nto-tdep.c (nto_find_and_open_solib): Allocate all buffers dynamically to support arbitrary root paths. Check for basename of lib in search path and then check for absolute. (nto_in_dynsym_resolve_code): New function. (nto_core_sniffer): New function. (regset_core_fns): Register core sniffer. (nto_initialize_signals): New function. (_initialize_nto_tdep): Move signal initialization code to above to avoid initialization race conditions. (nto_set_target): New function. * nto-procfs.c: Minor formatting/indenting changes. (procfs_is_nto_target): New function. (procfs_open): Set nto_is_nto_target. (_initialize_procfs): Ditto. Remove notice_signals() call to avoid initialization race conditions. (procfs_create_inferior): Resume inferior after creation. * i386-nto-tdep.c: Declare i386_nto_target. (init_i386nto_ops): Initialize i386_nto_target instead of current_nto_target. (i386nto_init_abi): Initialize signals. Call nto_set_target. Set TARGET_SO_IN_DYNSYM_RESOLVE_CODE. (_initialize_i386nto_tdep): Call init_i386nto_ops. Register osabi sniffer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog31
-rw-r--r--gdb/i386-nto-tdep.c29
-rw-r--r--gdb/nto-procfs.c50
-rw-r--r--gdb/nto-tdep.c125
-rw-r--r--gdb/nto-tdep.h139
5 files changed, 267 insertions, 107 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4aa6ea7..09ba649 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+2004-12-10 Kris Warkentin <kewarken@qnx.com>
+
+ * nto-tdep.h: Include osabi.h. Prototypes for generic Neutrino
+ osabi sniffer, signal handling initializer, 'in_dynsym_resolve_code'
+ function and nto_set_target function.
+ (struct nto_target_ops): Put comments inline with struct. Add osabi
+ sniffer hook. Redefine macros to permit testing/assignment. Remove
+ nto_ prefix from members.
+ * nto-tdep.c (nto_find_and_open_solib): Allocate all buffers
+ dynamically to support arbitrary root paths. Check for basename of
+ lib in search path and then check for absolute.
+ (nto_in_dynsym_resolve_code): New function.
+ (nto_core_sniffer): New function.
+ (regset_core_fns): Register core sniffer.
+ (nto_initialize_signals): New function.
+ (_initialize_nto_tdep): Move signal initialization code to above to
+ avoid initialization race conditions.
+ (nto_set_target): New function.
+ * nto-procfs.c: Minor formatting/indenting changes.
+ (procfs_is_nto_target): New function.
+ (procfs_open): Set nto_is_nto_target.
+ (_initialize_procfs): Ditto. Remove notice_signals() call to avoid
+ initialization race conditions.
+ (procfs_create_inferior): Resume inferior after creation.
+ * i386-nto-tdep.c: Declare i386_nto_target.
+ (init_i386nto_ops): Initialize i386_nto_target instead of
+ current_nto_target.
+ (i386nto_init_abi): Initialize signals. Call nto_set_target. Set
+ TARGET_SO_IN_DYNSYM_RESOLVE_CODE.
+ (_initialize_i386nto_tdep): Call init_i386nto_ops. Register osabi sniffer.
+
2004-12-10 Mark Kettenis <kettenis@gnu.org>
* hppa-hpux-tdep.c (child_enable_exception_callback): Use XMALLOC.
diff --git a/gdb/i386-nto-tdep.c b/gdb/i386-nto-tdep.c
index 30f6238..d6a6f8a 100644
--- a/gdb/i386-nto-tdep.c
+++ b/gdb/i386-nto-tdep.c
@@ -59,6 +59,8 @@ static int regmap[] = {
(-1 * 4) /* filler */
};
+static struct nto_target_ops i386_nto_target;
+
/* Given a gdb regno, return the offset into Neutrino's register structure
or -1 if register is unknown. */
static int
@@ -258,14 +260,14 @@ i386nto_sigcontext_addr (struct frame_info *next_frame)
static void
init_i386nto_ops (void)
{
- current_nto_target.nto_regset_id = i386nto_regset_id;
- current_nto_target.nto_supply_gregset = i386nto_supply_gregset;
- current_nto_target.nto_supply_fpregset = i386nto_supply_fpregset;
- current_nto_target.nto_supply_altregset = nto_dummy_supply_regset;
- current_nto_target.nto_supply_regset = i386nto_supply_regset;
- current_nto_target.nto_register_area = i386nto_register_area;
- current_nto_target.nto_regset_fill = i386nto_regset_fill;
- current_nto_target.nto_fetch_link_map_offsets =
+ i386_nto_target.regset_id = i386nto_regset_id;
+ i386_nto_target.supply_gregset = i386nto_supply_gregset;
+ i386_nto_target.supply_fpregset = i386nto_supply_fpregset;
+ i386_nto_target.supply_altregset = nto_dummy_supply_regset;
+ i386_nto_target.supply_regset = i386nto_supply_regset;
+ i386_nto_target.register_area = i386nto_register_area;
+ i386_nto_target.regset_fill = i386nto_regset_fill;
+ i386_nto_target.fetch_link_map_offsets =
i386nto_svr4_fetch_link_map_offsets;
}
@@ -274,6 +276,9 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ /* Deal with our strange signals. */
+ nto_initialize_signals ();
+
/* NTO uses ELF. */
i386_elf_init_abi (info, gdbarch);
@@ -301,12 +306,18 @@ i386nto_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Supply a nice function to find our solibs. */
TARGET_SO_FIND_AND_OPEN_SOLIB = nto_find_and_open_solib;
- init_i386nto_ops ();
+ /* Our linker code is in libc. */
+ TARGET_SO_IN_DYNSYM_RESOLVE_CODE = nto_in_dynsym_resolve_code;
+
+ nto_set_target (&i386_nto_target);
}
void
_initialize_i386nto_tdep (void)
{
+ init_i386nto_ops ();
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_QNXNTO,
i386nto_init_abi);
+ gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
+ nto_elf_osabi_sniffer);
}
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 227d4e3..0b13d35 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -97,20 +97,26 @@ static unsigned nto_procfs_node = ND_LOCAL_NODE;
is required is because QNX node descriptors are transient so
we have to re-acquire them every time. */
static unsigned
-nto_node(void)
+nto_node (void)
{
unsigned node;
- if (ND_NODE_CMP(nto_procfs_node, ND_LOCAL_NODE) == 0)
+ if (ND_NODE_CMP (nto_procfs_node, ND_LOCAL_NODE) == 0)
return ND_LOCAL_NODE;
- node = netmgr_strtond(nto_procfs_path,0);
+ node = netmgr_strtond (nto_procfs_path, 0);
if (node == -1)
- error ("Lost the QNX node. Debug session probably over.");
+ error ("Lost the QNX node. Debug session probably over.");
return (node);
}
+static enum gdb_osabi
+procfs_is_nto_target (bfd *abfd)
+{
+ return GDB_OSABI_QNXNTO;
+}
+
/* This is called when we call 'target procfs <arg>' from the (gdb) prompt.
For QNX6 (nto), the only valid arg will be a QNX node string,
eg: "/net/some_node". If arg is not a valid QNX node, we will
@@ -124,6 +130,8 @@ procfs_open (char *arg, int from_tty)
int fd, total_size;
procfs_sysinfo *sysinfo;
+ nto_is_nto_target = procfs_is_nto_target;
+
/* Set the default node used for spawning to this one,
and only override it if there is a valid arg. */
@@ -153,7 +161,8 @@ procfs_open (char *arg, int from_tty)
*endstr = 0;
}
}
- snprintf (nto_procfs_path, PATH_MAX - 1, "%s%s", nodestr ? nodestr : "", "/proc");
+ snprintf (nto_procfs_path, PATH_MAX - 1, "%s%s", nodestr ? nodestr : "",
+ "/proc");
if (nodestr)
xfree (nodestr);
@@ -271,7 +280,7 @@ procfs_pidlist (char *args, int from_tty)
if (dp == NULL)
{
fprintf_unfiltered (gdb_stderr, "failed to opendir \"%s\" - %d (%s)",
- nto_procfs_path, errno, safe_strerror (errno));
+ nto_procfs_path, errno, safe_strerror (errno));
return;
}
@@ -299,7 +308,7 @@ procfs_pidlist (char *args, int from_tty)
if (fd == -1)
{
fprintf_unfiltered (gdb_stderr, "failed to open %s - %d (%s)\n",
- buf, errno, safe_strerror (errno));
+ buf, errno, safe_strerror (errno));
closedir (dp);
return;
}
@@ -308,8 +317,8 @@ procfs_pidlist (char *args, int from_tty)
if (devctl (fd, DCMD_PROC_INFO, pidinfo, sizeof (buf), 0) != EOK)
{
fprintf_unfiltered (gdb_stderr,
- "devctl DCMD_PROC_INFO failed - %d (%s)\n", errno,
- safe_strerror (errno));
+ "devctl DCMD_PROC_INFO failed - %d (%s)\n",
+ errno, safe_strerror (errno));
break;
}
num_threads = pidinfo->num_threads;
@@ -375,7 +384,8 @@ procfs_meminfo (char *args, int from_tty)
err = devctl (ctl_fd, DCMD_PROC_MAPINFO, NULL, 0, &num);
if (err != EOK)
{
- printf ("failed devctl num mapinfos - %d (%s)\n", err, safe_strerror (err));
+ printf ("failed devctl num mapinfos - %d (%s)\n", err,
+ safe_strerror (err));
return;
}
@@ -565,7 +575,7 @@ do_attach (ptid_t ptid)
if (devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0) == EOK
&& status.flags & _DEBUG_FLAG_STOPPED)
- SignalKill (nto_node(), PIDGET (ptid), 0, SIGCONT, 0, 0);
+ SignalKill (nto_node (), PIDGET (ptid), 0, SIGCONT, 0, 0);
attach_flag = 1;
nto_init_solib_absolute_prefix ();
return ptid;
@@ -778,7 +788,7 @@ procfs_detach (char *args, int from_tty)
siggnal = atoi (args);
if (siggnal)
- SignalKill (nto_node(), PIDGET (inferior_ptid), 0, siggnal, 0, 0);
+ SignalKill (nto_node (), PIDGET (inferior_ptid), 0, siggnal, 0, 0);
close (ctl_fd);
ctl_fd = -1;
@@ -868,8 +878,8 @@ procfs_resume (ptid_t ptid, int step, enum target_signal signo)
{
if (signal_to_pass != status.info.si_signo)
{
- SignalKill (nto_node(), PIDGET (inferior_ptid), 0, signal_to_pass,
- 0, 0);
+ SignalKill (nto_node (), PIDGET (inferior_ptid), 0,
+ signal_to_pass, 0, 0);
run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG;
}
else /* Let it kill the program without telling us. */
@@ -892,7 +902,7 @@ procfs_mourn_inferior (void)
{
if (!ptid_equal (inferior_ptid, null_ptid))
{
- SignalKill (nto_node(), PIDGET (inferior_ptid), 0, SIGKILL, 0, 0);
+ SignalKill (nto_node (), PIDGET (inferior_ptid), 0, SIGKILL, 0, 0);
close (ctl_fd);
}
inferior_ptid = null_ptid;
@@ -1042,7 +1052,7 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
if (ND_NODE_CMP (nto_procfs_node, ND_LOCAL_NODE) != 0)
{
- inherit.nd = nto_node();
+ inherit.nd = nto_node ();
inherit.flags |= SPAWN_SETND;
inherit.flags &= ~SPAWN_EXEC;
}
@@ -1055,7 +1065,8 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
sigprocmask (SIG_BLOCK, &set, NULL);
if (pid == -1)
- error ("Error spawning %s: %d (%s)", argv[0], errno, safe_strerror (errno));
+ error ("Error spawning %s: %d (%s)", argv[0], errno,
+ safe_strerror (errno));
if (fds[0] != STDIN_FILENO)
close (fds[0]);
@@ -1083,6 +1094,8 @@ procfs_create_inferior (char *exec_file, char *allargs, char **env,
|| (symfile_objfile != NULL && symfile_objfile->obfd != NULL))
SOLIB_CREATE_INFERIOR_HOOK (pid);
#endif
+ stop_soon = 0;
+ proceed (-1, TARGET_SIGNAL_DEFAULT, 0);
}
static void
@@ -1324,7 +1337,6 @@ _initialize_procfs (void)
/* Set up trace and fault sets, as gdb expects them. */
sigemptyset (&run.trace);
- notice_signals ();
/* Stuff some information. */
nto_cpuinfo_flags = SYSPAGE_ENTRY (cpuinfo)->flags;
@@ -1332,6 +1344,8 @@ _initialize_procfs (void)
add_info ("pidlist", procfs_pidlist, "pidlist");
add_info ("meminfo", procfs_meminfo, "memory information");
+
+ nto_is_nto_target = procfs_is_nto_target;
}
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 50b4fc5..b882a22 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -65,6 +65,19 @@ nto_target (void)
#endif
}
+void
+nto_set_target(struct nto_target_ops *targ)
+{
+ nto_regset_id = targ->regset_id;
+ nto_supply_gregset = targ->supply_gregset;
+ nto_supply_fpregset = targ->supply_fpregset;
+ nto_supply_altregset = targ->supply_altregset;
+ nto_supply_regset = targ->supply_regset;
+ nto_register_area = targ->register_area;
+ nto_regset_fill = targ->regset_fill;
+ nto_fetch_link_map_offsets = targ->fetch_link_map_offsets;
+}
+
/* Take a string such as i386, rs6000, etc. and map it onto CPUTYPE_X86,
CPUTYPE_PPC, etc. as defined in nto-share/dsmsgs.h. */
int
@@ -86,10 +99,10 @@ nto_map_arch_to_cputype (const char *arch)
int
nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
{
- char *buf, arch_path[PATH_MAX], *nto_root, *endian;
+ char *buf, *arch_path, *nto_root, *endian, *base;
const char *arch;
- char *path_fmt = "%s/lib:%s/usr/lib:%s/usr/photon/lib\
-:%s/usr/photon/dll:%s/lib/dll";
+ int ret;
+#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)
@@ -109,13 +122,38 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
endian = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "be" : "le";
}
+ /* In case nto_root is short, add strlen(solib)
+ so we can reuse arch_path below. */
+ arch_path =
+ alloca (strlen (nto_root) + strlen (arch) + strlen (endian) + 2 +
+ strlen (solib));
sprintf (arch_path, "%s/%s%s", nto_root, arch, endian);
- buf = alloca (strlen (path_fmt) + strlen (arch_path) * 5 + 1);
- sprintf (buf, path_fmt, arch_path, arch_path, arch_path, arch_path,
+ buf = alloca (strlen (PATH_FMT) + strlen (arch_path) * 5 + 1);
+ sprintf (buf, PATH_FMT, arch_path, arch_path, arch_path, arch_path,
arch_path);
- return openp (buf, OPF_TRY_CWD_FIRST, solib, o_flags, 0, temp_pathname);
+ /* Don't assume basename() isn't destructive. */
+ base = strrchr (solib, '/');
+ if (!base)
+ base = solib;
+ else
+ base++; /* Skip over '/'. */
+
+ ret = openp (buf, 1, base, o_flags, 0, temp_pathname);
+ if (ret < 0 && base != solib)
+ {
+ sprintf (arch_path, "/%s", solib);
+ ret = open (arch_path, o_flags, 0);
+ if (temp_pathname)
+ {
+ if (ret >= 0)
+ *temp_pathname = gdb_realpath (arch_path);
+ else
+ **temp_pathname = '\0';
+ }
+ }
+ return ret;
}
void
@@ -266,6 +304,51 @@ nto_relocate_section_addresses (struct so_list *so, struct section_table *sec)
sec->endaddr = nto_truncate_ptr (sec->endaddr + LM_ADDR (so) - vaddr);
}
+/* This is cheating a bit because our linker code is in libc.so. If we
+ ever implement lazy linking, this may need to be re-examined. */
+int
+nto_in_dynsym_resolve_code (CORE_ADDR pc)
+{
+ if (in_plt_section (pc, NULL))
+ return 1;
+ return 0;
+}
+
+void
+nto_generic_supply_gpregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *gregs, size_t len)
+{
+}
+
+void
+nto_generic_supply_fpregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *fpregs, size_t len)
+{
+}
+
+void
+nto_generic_supply_altregset (const struct regset *regset,
+ struct regcache *regcache, int regnum,
+ const void *altregs, size_t len)
+{
+}
+
+void
+nto_dummy_supply_regset (char *regs)
+{
+ /* Do nothing. */
+}
+
+enum gdb_osabi
+nto_elf_osabi_sniffer (bfd *abfd)
+{
+ if (nto_is_nto_target)
+ 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)
@@ -287,12 +370,6 @@ fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
}
}
-void
-nto_dummy_supply_regset (char *regs)
-{
- /* Do nothing. */
-}
-
/* Register that we are able to handle ELF file formats using standard
procfs "regset" structures. */
static struct core_fns regset_core_fns = {
@@ -304,18 +381,8 @@ static struct core_fns regset_core_fns = {
};
void
-_initialize_nto_tdep (void)
+nto_initialize_signals (void)
{
- add_setshow_zinteger_cmd ("nto-debug", class_maintenance,
- &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);
-
/* We use SIG45 for pulses, or something, so nostop, noprint
and pass them. */
signal_stop_update (target_signal_from_name ("SIG45"), 0);
@@ -334,7 +401,19 @@ QNX NTO internal debugging is %s.",
signal_print_update (SIGPHOTON, 0);
signal_pass_update (SIGPHOTON, 1);
#endif
+}
+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.", "\
+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);
}
diff --git a/gdb/nto-tdep.h b/gdb/nto-tdep.h
index e22e8fd..c903bab 100644
--- a/gdb/nto-tdep.h
+++ b/gdb/nto-tdep.h
@@ -26,49 +26,15 @@
#include "defs.h"
#include "solist.h"
-
-/* Generic functions in nto-tdep.c. */
-
-extern void nto_init_solib_absolute_prefix (void);
-
-char **nto_parse_redirection (char *start_argv[], char **in,
- char **out, char **err);
-
-int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
-
-void nto_relocate_section_addresses (struct so_list *, struct section_table *);
-
-int nto_map_arch_to_cputype (const char *);
-
-int nto_find_and_open_solib (char *, unsigned, char **);
-
-/* Dummy function for initializing nto_target_ops on targets which do
- not define a particular regset. */
-void nto_dummy_supply_regset (char *regs);
+#include "osabi.h"
+#include "regset.h"
/* Target operations defined for Neutrino targets (<target>-nto-tdep.c). */
struct nto_target_ops
{
- int nto_internal_debugging;
- unsigned nto_cpuinfo_flags;
- int nto_cpuinfo_valid;
-
- int (*nto_regset_id) (int);
- void (*nto_supply_gregset) (char *);
- void (*nto_supply_fpregset) (char *);
- void (*nto_supply_altregset) (char *);
- void (*nto_supply_regset) (int, char *);
- int (*nto_register_area) (int, int, unsigned *);
- int (*nto_regset_fill) (int, char *);
- struct link_map_offsets *(*nto_fetch_link_map_offsets) (void);
-};
-
-extern struct nto_target_ops current_nto_target;
-
/* For 'maintenance debug nto-debug' command. */
-#define nto_internal_debugging \
- (current_nto_target.nto_internal_debugging)
+ int internal_debugging;
/* The CPUINFO flags from the remote. Currently used by
i386 for fxsave but future proofing other hosts.
@@ -76,47 +42,69 @@ extern struct nto_target_ops current_nto_target;
depending on our host/target. It would only be invalid
if we were talking to an older pdebug which didn't support
the cpuinfo message. */
-#define nto_cpuinfo_flags \
- (current_nto_target.nto_cpuinfo_flags)
+ unsigned cpuinfo_flags;
/* True if successfully retrieved cpuinfo from remote. */
-#define nto_cpuinfo_valid \
- (current_nto_target.nto_cpuinfo_valid)
+ int cpuinfo_valid;
/* Given a register, return an id that represents the Neutrino
regset it came from. If reg == -1 update all regsets. */
-#define nto_regset_id(reg) \
- (*current_nto_target.nto_regset_id) (reg)
+ int (*regset_id) (int);
-#define nto_supply_gregset(regs) \
- (*current_nto_target.nto_supply_gregset) (regs)
+ void (*supply_gregset) (char *);
-#define nto_supply_fpregset(regs) \
- (*current_nto_target.nto_supply_fpregset) (regs)
+ void (*supply_fpregset) (char *);
-#define nto_supply_altregset(regs) \
- (*current_nto_target.nto_supply_altregset) (regs)
+ void (*supply_altregset) (char *);
/* Given a regset, tell gdb about registers stored in data. */
-#define nto_supply_regset(regset, data) \
- (*current_nto_target.nto_supply_regset) (regset, data)
+ void (*supply_regset) (int, char *);
/* Given a register and regset, calculate the offset into the regset
and stuff it into the last argument. If regno is -1, calculate the
size of the entire regset. Returns length of data, -1 if unknown
regset, 0 if unknown register. */
-#define nto_register_area(reg, regset, off) \
- (*current_nto_target.nto_register_area) (reg, regset, off)
+ int (*register_area) (int, int, unsigned *);
/* Build the Neutrino register set info into the data buffer.
Return -1 if unknown regset, 0 otherwise. */
-#define nto_regset_fill(regset, data) \
- (*current_nto_target.nto_regset_fill) (regset, data)
+ int (*regset_fill) (int, char *);
/* Gives the fetch_link_map_offsets function exposure outside of
solib-svr4.c so that we can override relocate_section_addresses(). */
-#define nto_fetch_link_map_offsets() \
- (*current_nto_target.nto_fetch_link_map_offsets) ()
+ struct link_map_offsets *(*fetch_link_map_offsets) (void);
+
+/* Used by nto_elf_osabi_sniffer to determine if we're connected to an
+ Neutrino target. */
+ enum gdb_osabi (*is_nto_target) (bfd *abfd);
+};
+
+extern struct nto_target_ops current_nto_target;
+
+#define nto_internal_debugging (current_nto_target.internal_debugging)
+
+#define nto_cpuinfo_flags (current_nto_target.cpuinfo_flags)
+
+#define nto_cpuinfo_valid (current_nto_target.cpuinfo_valid)
+
+#define nto_regset_id (current_nto_target.regset_id)
+
+#define nto_supply_gregset (current_nto_target.supply_gregset)
+
+#define nto_supply_fpregset (current_nto_target.supply_fpregset)
+
+#define nto_supply_altregset (current_nto_target.supply_altregset)
+
+#define nto_supply_regset (current_nto_target.supply_regset)
+
+#define nto_register_area (current_nto_target.register_area)
+
+#define nto_regset_fill (current_nto_target.regset_fill)
+
+#define nto_fetch_link_map_offsets \
+(current_nto_target.fetch_link_map_offsets)
+
+#define nto_is_nto_target (current_nto_target.is_nto_target)
/* Keep this consistant with neutrino syspage.h. */
enum
@@ -153,4 +141,41 @@ typedef struct _debug_regs
qnx_reg64 padding[1024];
} nto_regset_t;
+/* Generic functions in nto-tdep.c. */
+
+void nto_init_solib_absolute_prefix (void);
+
+void nto_set_target(struct nto_target_ops *);
+
+char **nto_parse_redirection (char *start_argv[], char **in,
+ char **out, char **err);
+
+int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
+
+void nto_relocate_section_addresses (struct so_list *,
+ struct section_table *);
+
+int nto_map_arch_to_cputype (const char *);
+
+int nto_find_and_open_solib (char *, unsigned, char **);
+
+enum gdb_osabi nto_elf_osabi_sniffer (bfd *abfd);
+
+void nto_initialize_signals (void);
+
+void nto_generic_supply_gpregset (const struct regset *, struct regcache *,
+ int, const void *, size_t);
+
+void nto_generic_supply_fpregset (const struct regset *, struct regcache *,
+ int, const void *, size_t);
+
+void nto_generic_supply_altregset (const struct regset *, struct regcache *,
+ int, const void *, size_t);
+
+/* Dummy function for initializing nto_target_ops on targets which do
+ not define a particular regset. */
+void nto_dummy_supply_regset (char *regs);
+
+int nto_in_dynsym_resolve_code (CORE_ADDR pc);
+
#endif