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.
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.
: 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/".
(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.
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
This has been fixed by commit https://git.fedorahosted.org/cgit/elfutils.git/commit/?id=b901b5e742e03d781fe9b6ecf030d6d297948018.