This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] create sniffer for Neutrino core files
- From: "Kris Warkentin" <kewarken at qnx dot com>
- To: "Gdb-Patches at Sources dot Redhat dot Com" <gdb-patches at sources dot redhat dot com>
- Date: Thu, 10 Jul 2003 16:20:12 -0400
- Subject: [patch] create sniffer for Neutrino core files
This is leading in the direction of being able to sniff out QNX binaries
without adding anything to our file format. Earlier we were considering
adding a .note.qnxnto.ident to our binaries so that gdb could recognize and
use the appropriate OSABI. Our architect doesn't like adding to/changing
our binaries so he wants me to try to do it this way. The theory is, we
KNOW if we're attached to a remote Neutrino machine. We KNOW if we've got a
Neutrino core file. We KNOW if we're running on native Neutrino.
Given all that we know, we shouldn't need to do anything to our binaries but
rather just have an osabi sniffer that TELLS gdb that it should use
GDB_OSABI_QNXNTO. This patch will tell us that we've got a core file so now
all I need is a sniffer for the other two.
Anyone see any problems with this?
cheers,
Kris
ChangeLog:
* nto-tdep.c (nto_core_sniffer): New function to detect QNX core file.
(regset_core_fns): Use nto_core_sniffer instead of default_core_sniffer.
$ cvs diff -u nto-tdep.c
Index: nto-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-tdep.c,v
retrieving revision 1.6
diff -u -r1.6 nto-tdep.c
--- nto-tdep.c 17 Jun 2003 18:30:48 -0000 1.6
+++ nto-tdep.c 10 Jul 2003 20:10:58 -0000
@@ -293,12 +293,20 @@
/* Do nothing. */
}
+static int
+nto_core_sniffer(struct core_fns *our_fns, bfd *abfd)
+{
+ if (bfd_get_section_by_name (abfd, ".qnx_core_info"))
+ return 1;
+ return default_core_sniffer(our_fns, abfd);
+}
+
/* 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 */
+ nto_core_sniffer, /* core_sniffer */
fetch_core_registers, /* core_read_registers */
NULL /* next */
};