<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Standalone debug file search path does not match GDB"
   href="http://llvm.org/bugs/show_bug.cgi?id=17903">17903</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Standalone debug file search path does not match GDB
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>emaste@freebsd.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>See e.g. <a href="https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html">https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html</a>

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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>