Bug 1253367 - find_debuginfo_in_path() can have difficulties locating split debug info files when build-id is not used
find_debuginfo_in_path() can have difficulties locating split debug info file...
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: elfutils (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Mark Wielaard
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-13 10:38 EDT by Dodji Seketeli
Modified: 2015-08-17 09:40 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-17 09:40:47 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dodji Seketeli 2015-08-13 10:38:56 EDT
This bug is extracted from a bug filed to libabigail at https://sourceware.org/bugzilla/show_bug.cgi?id=18792.

Basically when a library /prefix1/prefix2/libfoo.so has its split debug info at /prefix1/usr/lib/debug/prefix2/libfoo.so, and the debug_link property of the library contains "libfoo.so" which designates the name of the of the debug info file, and the Dwfl_Callbacks::debuginfo_path is correctly set to point to /prefix1/usr/lib/debug, dwfl_module_getdwarf() fails to locate the split debug info file.
Comment 1 Dodji Seketeli 2015-08-13 10:42:50 EDT
I have debugged this and it seems to me that find_debuginfo_in_path() is the one function that is having difficulties in locating the debug infor file libfoo.so under /usr/prefix1/usr/lib/debug.

I have cooked a patch candidate (which comes with no test case yet, alas) that fixes the issue for me, but I'd like your input as to what I might not be doing correctly.

The patch is attached to bug https://sourceware.org/bugzilla/show_bug.cgi?id=18792#c5 and can be viewed at https://sourceware.org/bugzilla/attachment.cgi?id=8517&action=diff.
Comment 2 Mark Wielaard 2015-08-13 18:01:18 EDT
:
A nicer URL to view the proposed patch plus explanation is:
https://sourceware.org/bugzilla/attachment.cgi?id=8517

I think I understand the proposed change and why it makes sense to try and strip prefix paths under the debuginfo_path during the search. But the following part in the explanation confuses me:

> The problem is, when find_debuginfo_in_path() is called with its
> file_name parameter set to "/prefix1/prefix2/libfoo.so" and
> mod->dwfl->callbacks->debuginfo_path set to
> "/prefix1/lib/debug/prefix2/libfoo.so", it fails to locate the debug
> info file libfoo.so under "/prefix1/lib/debug".

Should that have been:

  ... debuginfo_path set to "/prefix1/lib/debug/", it fails to locate
  the debug info file libfoo.so under "/prefix1/usr/lib/debug/prefix2/".
Comment 3 Dodji Seketeli 2015-08-14 04:42:16 EDT
(In reply to Mark Wielaard from comment #2)
> :
> A nicer URL to view the proposed patch plus explanation is:
> https://sourceware.org/bugzilla/attachment.cgi?id=8517
> 
> I think I understand the proposed change and why it makes sense to try and
> strip prefix paths under the debuginfo_path during the search. But the
> following part in the explanation confuses me:
> 
> > The problem is, when find_debuginfo_in_path() is called with its
> > file_name parameter set to "/prefix1/prefix2/libfoo.so" and
> > mod->dwfl->callbacks->debuginfo_path set to
> > "/prefix1/lib/debug/prefix2/libfoo.so", it fails to locate the debug
> > info file libfoo.so under "/prefix1/lib/debug".
> 
> Should that have been:
> 
>   ... debuginfo_path set to "/prefix1/lib/debug/", it fails to locate
>   the debug info file libfoo.so under "/prefix1/usr/lib/debug/prefix2/".

You are right, I messed up that part of the explanation! Sorry.
Comment 4 Mark Wielaard 2015-08-14 10:43:40 EDT
Posted a tweaked version of the patch and a testcase to the elfutils list:
https://lists.fedorahosted.org/pipermail/elfutils-devel/2015-August/005082.html
Comment 5 Dodji Seketeli 2015-08-17 09:40:47 EDT
This has been fixed by commit https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=b901b5e742e03d781fe9b6ecf030d6d297948018.

Note You need to log in before you can comment on or make changes to this bug.