Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] create sniffer for Neutrino core files
@ 2003-07-10 20:19 Kris Warkentin
  2003-08-04 14:17 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Kris Warkentin @ 2003-07-10 20:19 UTC (permalink / raw)
  To: Gdb-Patches@Sources.Redhat.Com

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 */
 };



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] create sniffer for Neutrino core files
  2003-07-10 20:19 [patch] create sniffer for Neutrino core files Kris Warkentin
@ 2003-08-04 14:17 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2003-08-04 14:17 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: Gdb-Patches@Sources.Redhat.Com

> 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?

Having just posted something similar to i386, no definitly not.

Andrew


> 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 */
>  };
> 
> 
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-08-04 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-10 20:19 [patch] create sniffer for Neutrino core files Kris Warkentin
2003-08-04 14:17 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox