Re: Why does solib_open do what it does?

Kevin Buettner
2003-06-17T20:01:51Z

On Jun 17, 3:14pm, Kris Warkentin wrote:
> Subject: Re: Why does solib_open do what it does?
> > On Tue, Jun 17, 2003 at 03:01:25PM -0400, Kris Warkentin wrote:
> > > I'm looking at solib.c:solib_open() and as I go down the list:
> > >
> > > Search order:
> > > 1 * If path is absolute, look in SOLIB_ABSOLUTE_PREFIX.
> > > 2 * If path is absolute or relative, look for it literally
> (unmodified).
> > > 3 * Look in SOLIB_SEARCH_PATH.
> > > 4 * If available, use target defined search function.
> > > 5 * Look in inferior's $PATH.
> > > 6 * Look in inferior's $LD_LIBRARY_PATH.
> > >
> > > I'm puzzled. Why are we testing for the existence of solib_search_path
> > > before checking 5 and 6?
> >
> > You'll have to get Kevin's opinion, but it looks like a paste-o to me.
>
> That's what I was thinking too. A customer reported that when they don't
> set solib-search-path, all of a sudden gdb isn't finding solibs that used to
> be found in LD_LIBRARY_PATH.

It sounds to me like the solibs in question were actually being found via
solib-search-path, not LD_LIBRARY_PATH.

I think the problem with using LD_LIBRARY_PATH is that the paths
won't be correct without some sort of adjustment. I.e, the paths
provided by LD_LIBRARY_PATH are target filesystem paths, not host
paths.

> You think it's okay for me to fix it?

Not yet. I want to study the code some more first.

...

Actually, the one that bothers me is (2). I think we ought to be doing
(2) after (3).

Kevin