Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Kris Warkentin <kewarken@qnx.com>
Cc: "Gdb-Patches@Sources.Redhat.Com" <gdb-patches@sources.redhat.com>
Subject: Re: [Patch] arch recognition fix for osabi.c
Date: Tue, 17 Jun 2003 15:51:00 -0000	[thread overview]
Message-ID: <20030617155147.GA25280@nevyn.them.org> (raw)
In-Reply-To: <08c201c334e6$ccb8c750$0202040a@catdog>

On Tue, Jun 17, 2003 at 11:40:37AM -0400, Kris Warkentin wrote:
> Here are some changes to osabi.c that allow gdb to recognize QNX binaries
> properly.  The arch check change in gdbarch_init_osabi() allows the backend
> abi_init handlers to run.  I believe the comment still stand - we will
> probably want to do something smarter in the future.
> 
> The sniff change is only temporary.  It works reasonably well for now and
> will probably stay for backwards compatability but we are also going to add
> a special .note section like others OSes in the future.  Then we can check
> for both.
> 
> cheers,
> 
> Kris
> 
> Changelog:
>     * osabi.c (gdbarch_init_osabi): Just check arch for compatability rather
> identicality.

Your mailer is eating indentation again...

This half I'm not convinced by.  From our previous exchange I don't
think you've fully justified it.  Not approved without more discussion.

>       (generic_elf_osabi_sniff_abi_tag_sections): Add check for QNX Neutrino
> binaries.

This bit looks fine, except for two things: you've missed the coding
standards by four space characters (before left parens), and your
"safety first" check overruns the buffer (missing +1 in the alloca).

> Index: osabi.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/osabi.c,v
> retrieving revision 1.15
> diff -u -r1.15 osabi.c
> --- osabi.c 8 Jun 2003 18:27:14 -0000 1.15
> +++ osabi.c 17 Jun 2003 15:32:53 -0000
> @@ -311,8 +311,7 @@
>    type that is compatible with the desired machine type.  Right
>    now we simply return the first match, which is fine for now.
>    However, we might want to do something smarter in the future.  */
> -      compatible = arch_info->compatible (arch_info, handler->arch_info);
> -      if (compatible == handler->arch_info)
> +      if(arch_info->compatible (arch_info, handler->arch_info))
>   {
>     (*handler->init_osabi) (info, gdbarch);
>     return;
> @@ -430,6 +429,17 @@
>        necessary yet.  */
>     *os_ident_ptr = GDB_OSABI_NETBSD_ELF;
>   }
> +      return;
> +    }
> +
> +  /* QNX Neutrino has ldqnx.so as its linker.  */
> +  if (strcmp (name, ".interp") == 0 && sectsize > 0)
> +    {
> +      char *buf = alloca(sectsize);
> +      bfd_get_section_contents(abfd, sect, buf, 0, sectsize);
> +      buf[sectsize] = '\0'; /* Safety first boys and girls.  */
> +      if(strstr(buf, "ldqnx.so"))
> +        *os_ident_ptr = GDB_OSABI_QNXNTO;
>        return;
>      }
>  }
> 
> 
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2003-06-17 15:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-17 15:40 Kris Warkentin
2003-06-17 15:51 ` Daniel Jacobowitz [this message]
2003-06-17 16:04   ` Kris Warkentin
2003-06-19 12:25     ` Kris Warkentin
2003-06-19 13:18       ` Daniel Jacobowitz
2003-06-19 14:48         ` Kris Warkentin
2003-06-19 19:09     ` Daniel Jacobowitz
2003-06-19 22:10       ` Kevin Buettner
2003-07-11 15:04       ` [ping] " Kris Warkentin
2003-07-11 16:27         ` Mark Kettenis
2003-07-11 16:32           ` Daniel Jacobowitz
2003-07-18 14:13           ` Andrew Cagney
2003-07-18 14:19             ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030617155147.GA25280@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kewarken@qnx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox