Solib loading of bare file names

Andrew STUBBS andrew.stubbs@st.com
Mon Oct 30 19:20:00 GMT 2006


I'm having trouble with solib_open and loading of library files when 
only the bare file name is known (i.e. there is no absolute or relative 
path).

Obviously I would like GDB to be able to find these files with the 
minimum of trouble, and the current search implementation is perhaps a 
little deficient, but I am having trouble figuring out what is the 
intended behaviour.

The comment at the top of solib_open begins as follows:

    * If there is a solib_absolute_prefix and path is absolute:
    *   Search for solib_absolute_prefix/path.
    * else
    *   Look for it literally (unmodified).

This would appear to indicate that a bare file name would fall into the 
'else' case and Just Work.

What actually happens is that the literal lookup only occurs for 
relative paths. I.e. file names with directory separators in them.

The comment (which says what I want to happen) and the code seem to be 
at odds. Would a patch to rectify the code be welcome, or would you 
prefer the comment corrected?

I know that 'set solib-search-path .' will solve my problems, as does 
having my programs specify the file names with a './' prefix, but it 
would be less surprising if it could just find files in the current 
directory. Obviously, I don't expect it to find files not in the current 
directory without some help, but that's the point - I don't *expect* it 
to do that. I don't imagine the average user finds that surprising either.

Thanks

Andrew Stubbs



More information about the Gdb mailing list