This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFC]: Solib search (Was: Re: Cross solib support; continued)
On Tue, Nov 27, 2001 at 04:03:45PM +0100, Orjan Friberg wrote:
> Daniel Jacobowitz wrote:
> >
> > Other than that, we should fall back to solib-search-path and the
> > basename if solib-absolute-path fails for us, IMO. Would that work for
> > you? Set the absolute-path to /dev/null or so and then add the
> > fallback code.
>
> A quick recap: I'm doing solib debugging in a cross-environment, but the path to the
> target's solibs on my host doesn't correspond to the path on the target. More
> specifically, the path where I want to get the solibs from on my host doesn't end in
> /lib.
>
> This is a first shot at it. The latter part of the patch implements what Daniel
> suggested, but the first part is more controversial. The problem is when in_pathname
> contains an absolute path (say /lib/libc.so.6), but it's not found in the path
> specified by solib_absolute_prefix. When we try and search for the solib in
> solib_search_path, openp will find that the file name is an absolute path and open it
> (ignoring the supplied solib_search_path). As a result, it will pick up
> /lib/libc.so.6 on my host.
>
> My thought was to make the path relative if the search for the absolute path failed,
> by simply getting rid of the leading '/'. (It won't work with DOS based file
> systems, as the dir separator could be '\\', but that would be easy to add.)
> Needless to say, this works for me, but I'm not sure it's The Right Thing to do.
> (Another approach would be to change openp, but I'm sure there's a good reason for
> its current behaviour.)
I've got one concern with this. In native debugging, we want to open
the absolute path BEFORE searching solib-search-path - you might have
dlopened() a specific optimized version of a library whose base exists
in /usr/lib, for instance.
Perhaps you need to propogate knowledge of whether we are debugging
natively down to this point?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer