LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 17903 - Standalone debug file search path does not match GDB
Summary: Standalone debug file search path does not match GDB
Status: RESOLVED FIXED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC FreeBSD
: P normal
Assignee: emaste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-12 19:45 PST by emaste
Modified: 2013-11-25 14:34 PST (History)
0 users

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description emaste 2013-11-12 19:45:51 PST
See e.g. https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

For an example file /usr/bin/ls with a debuglink file of ls.debug, the search paths should be, in order:

    /usr/lib/debug/.build-id/ab/cdef1234.debug
    /usr/bin/ls.debug
    /usr/bin/.debug/ls.debug
    /usr/lib/debug/usr/bin/ls.debug

On FreeBSD, we use by default the 4th case from the GDB example above - /bin/ls has debug info in /usr/lib/debug/bin/ls.debug.

Adding some debug logging to Symbols::LocateExecutableSymbolFile shows the following paths being tried:
Directory /bin
Trying file /bin/ls.debug
Trying file /bin/.debug/ls.debug
Trying file /bin/.build-id/F4/DD1447000000000000000000000000.debug
Trying file /bin/bin/ls
Directory /data/emaste/src/llvm/build
Trying file /data/emaste/src/llvm/build/ls.debug
Trying file /data/emaste/src/llvm/build/.debug/ls.debug
Trying file /data/emaste/src/llvm/build/.build-id/F4/DD1447000000000000000000000000.debug
Trying file /data/emaste/src/llvm/build/bin/ls
Directory /usr/lib/debug
Trying file /usr/lib/debug/ls.debug
Trying file /usr/lib/debug/.debug/ls.debug
Trying file /usr/lib/debug/.build-id/F4/DD1447000000000000000000000000.debug
Trying file /usr/lib/debug/bin/ls


The current set of LLDB search paths is, for each of dirname in <module_dir>, <current dir>, and /usr/lib/debug:

        files.push_back (dirname + "/" + symbol_filename);                      
        files.push_back (dirname + "/.debug/" + symbol_filename);               
        files.push_back (dirname + "/.build-id/" + uuid_str);                   
        files.push_back (dirname + module_filename);                            

This ends up including extra paths not in GDB (e.g. /usr/bin/.build-id/<uuid_str>), and excluding paths that are (e.g. /usr/lib/debug/usr/bin/ls.debug).  The paths are also in a different order, compared to GDB.
Comment 1 emaste 2013-11-13 08:51:00 PST
Review: http://llvm-reviews.chandlerc.com/D2169
Comment 2 emaste 2013-11-15 10:22:20 PST
Committed to FreeBSD as http://svnweb.freebsd.org/base?view=revision&revision=258094
Comment 3 emaste 2013-11-25 14:34:42 PST
Committed as r195681