public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Kris Warkentin" <kewarken@qnx.com>
To: "Kris Warkentin" <kewarken@qnx.com>, <Richard.Earnshaw@arm.com>
Cc: "Kevin Buettner" <kevinb@redhat.com>,
	"Gdb@Sources.Redhat.Com" <gdb@sources.redhat.com>
Subject: Re: problem with fetch_link_map_offsets
Date: Wed, 11 Jun 2003 19:05:00 -0000	[thread overview]
Message-ID: <0a4201c3304c$786134b0$0202040a@catdog> (raw)
In-Reply-To: <050801c32f60$21211d10$0202040a@catdog>

Okay.  Looks like this fix only works for arm.  All the targets seem to call
the sniff function but at some point, the current_gdbarch is changing and
the fetch_link_map_offsets is pointing back to
legacy_fetch_link_map_offsets.

I've been stepping through all over the place and looking through the output
of set debug arch 1 and still not finding what I'm looking for.  The nearest
guess I can make is that somewhere in gdbarch_update_p, gdb is creating a
new gdbarch which is much like the one that I initialized but not quite.  I
have these nto_init_abi functions that are registered to the bfd and tied to
GDB_OSABI_QNXNTO.  Gdbarch_update_p is creating a new gdbarch, filling in
some fields, tagging it with GDB_OSABI_QNXNTO and carrying on.  Then things
fall apart because the new gdbarch has lost my fetch_link_map_offsets
pointer and current_gdbarch->data[1] is pointing back to the legacy_flmo.

Argh.

All I'm doing in my tdep init sections are things like this:

gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_QNXNTO, shnto_init_abi);

Then my init_abi function sets things up with calls to
set_solib_svr4_fetch_link_map_offsets and the like.  Am I doing something
wrong?  It almost looks like things need to happen in a different order or
the init function needs to be called again or something.

Any ideas?

cheers,

Kris

> Here's a fix that works right now:  If I put the code below into
> generic_elf_osabi_sniff_abi_tag_sections(), the sniffer does its job.  The
> problem with this is that it will only work on dynamically linked
binaries.
> Convenient as a stop-gap and for a certain amount of backwards
> compatability.  I think the .note.qnxnto.ident section is still a good
idea
> though.  I tried putting one into our crtbegin.o but then programs were
core
> dumping so I'm doing something wrong there.  I'll have to talk to the OS
> folks.
>
> cheers,
>
> Kris
>
>   /* 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;
>     }
>
>
>


      reply	other threads:[~2003-06-11 19:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-28 20:21 Kris Warkentin
2003-04-28 21:23 ` Andrew Cagney
2003-04-29 13:27   ` Kris Warkentin
2003-04-29 15:07 ` Kevin Buettner
2003-04-29 15:25   ` Kris Warkentin
2003-04-29 16:28     ` Kevin Buettner
2003-04-29 21:18       ` Kris Warkentin
2003-06-09 21:20         ` Kris Warkentin
2003-06-09 21:34           ` Kevin Buettner
2003-06-09 21:40             ` Kris Warkentin
2003-06-10 10:12               ` Richard Earnshaw
2003-06-10 12:21                 ` Kris Warkentin
2003-06-10 12:26                   ` Richard Earnshaw
2003-06-10 14:53                   ` Kris Warkentin
2003-06-11 19:05                     ` Kris Warkentin [this message]

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='0a4201c3304c$786134b0$0202040a@catdog' \
    --to=kewarken@qnx.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.redhat.com \
    --cc=kevinb@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).