Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Eager <eager@eagercon.com>
To: gdb@sourceware.org
Subject: Re: Finding ld.so dynamic loader
Date: Wed, 30 Jan 2008 16:53:00 -0000	[thread overview]
Message-ID: <47A0AB58.7050003@eagercon.com> (raw)
In-Reply-To: <47A0A8D8.7090508@eagercon.com>

It seems that as soon as I ask a question, the answer drops into
my lap.  There's a "set solib-absolute-prefix" command which
sets the prefix to use to find the shared libraries.

Michael Eager wrote:
> I've been reading through solib_open() in solib.c and the way
> that the code searches for the dynamic loader doesn't make sense
> to me, especially when using gdbserver to debug a program on
> a remote system.  Perhaps someone can explain to me why it is correct.
> 
> solib_open() is called by enable_break() with the name of
> the dynamic loader, say, "/lib/ld.so.1".  The comments at
> the top of solib_open() say:
> 
>  125    * If there is a solib_absolute_prefix and path is absolute:
>  126    *   Search for solib_absolute_prefix/path.
>  127    * else
>  128    *   Look for it literally (unmodified).
>  129    * Look in SOLIB_SEARCH_PATH.
>  130    * If available, use target defined search function.
>  131    * If solib_absolute_prefix is NOT set, perform the following two 
> searches:
>  132    *   Look in inferior's $PATH.
>  133    *   Look in inferior's $LD_LIBRARY_PATH.
> 
> If solib_absolute_prefix is empty (true for almost all targets) and
> /lib/ld.so.1 exists on the host system, this will be opened in
> preference to either one specified on the SOLIB_SEARCH_PATH or using a
> target search path.
> 
> This seems incorrect.  The dynamic loader on the host system
> may not be the same as on the target system, and in the case
> of cross development, may not even have the same architecture.
> Shouldn't the search using the unmodified name be the last choice,
> not the first?
> 
> Can someone explain to me how gdb is supposed to find the correct
> ld.so or why I'm looking at this incorrectly?
> 


-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077


  parent reply	other threads:[~2008-01-30 16:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 16:42 Michael Eager
2008-01-30 16:51 ` Daniel Jacobowitz
2008-01-30 17:00   ` Michael Eager
2008-01-30 17:47     ` Daniel Jacobowitz
2008-01-30 18:31       ` Michael Eager
2008-01-30 16:53 ` Michael Eager [this message]
2008-01-30 18:28 ` Mark Kettenis
2008-01-30 18:45   ` Michael Eager
2008-01-30 19:04     ` Paul Koning
2008-01-30 21:06       ` Michael Eager
2008-01-30 21:30         ` Mark Kettenis
2008-01-31 11:27         ` Michael Snyder

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=47A0AB58.7050003@eagercon.com \
    --to=eager@eagercon.com \
    --cc=gdb@sourceware.org \
    /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