From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3260 invoked by alias); 10 Jul 2003 20:19:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3253 invoked from network); 10 Jul 2003 20:19:46 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by sources.redhat.com with SMTP; 10 Jul 2003 20:19:46 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3p2/8.9.3) with ESMTP id QAA01891 for ; Thu, 10 Jul 2003 16:10:55 -0400 Received: from catdog ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with SMTP id QAA08683 for ; Thu, 10 Jul 2003 16:19:45 -0400 Message-ID: <0d4901c34720$aaa71cb0$0202040a@catdog> From: "Kris Warkentin" To: "Gdb-Patches@Sources.Redhat.Com" Subject: [patch] create sniffer for Neutrino core files Date: Thu, 10 Jul 2003 20:19:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-SW-Source: 2003-07/txt/msg00216.txt.bz2 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 */ };