<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi lldb-dev,<br>
</p>
<p><br>
</p>
<p>I'm trying to write some tooling to help with debugging complex builds on Mac.  The libraries all have debugging info separated into .dSYM/ directories.  Due to some complexities in our build system, the .dSYM directories with the debugging info have completely
 different base paths than the actual library being loaded, and there are multiple different base paths in use for the debug symbols.<br>
</p>
<p><br>
</p>
<p>For example,<br>
</p>
<p><br>
</p>
<p>Libraries without debugging symbols:<br>
</p>
<p>/path/to/my/workspace/bin/maci64/libA.dylib<br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">/path/to/my/workspace/<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">bin/maci64/</span>libB.dylib</span><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">/path/to/my/workspace/<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">bin/maci64/</span>libC.dylib</span><br>
</p>
<p>Corresponding debugging symbols:<br>
</p>
<p>/archive/builds/1234/<span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">bin/maci64/</span>libA.dylib.dSYM/Contents/Resources/DWARF/libA.dylib<br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">/archive/builds/2345/</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">bin/maci64/</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">​</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">libB</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">.d</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">ylib.dSY</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">M/Contents/Resources/DWARF/libB.dylib</span><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">/archive/builds/3456/</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">bin/maci64/</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">​</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">libC</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">.d</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">ylib.dSY</span><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">M/Contents/Resources/DWARF/libC.dylib</span><br>
</p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">I'm looking for an LLDB API (preferably part of the python API) that I can use to load the debug symbols for these libraries when the
 libraries in my workspace are loaded.</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">I've tried using 'lldb.target.AddModule()' to load an additional module after the original module is loaded (using the 4-arg version
 which allows a separate symfile to be specified).  After doing this though when I call GetNumCompileUnits() on the new module, it still reports 0.  I also have no idea if this module I just added will be used by LLDB instead of the one it originally loaded
 without debug symbols.</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">I've looked at locate_module_and_debug_symbols() in lldb.utils.symbolication.Image (as mentioned here: <a href="http://lldb.llvm.org/symbolication.html">http://lldb.llvm.org/symbolication.html</a>).
  Presumably I could create a custom class which overrides this method, however I didn't see any way to tell LLDB to use this custom method when loading modules.</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">I've also looked at the DBGShellCommands described here: <a href="http://lldb.llvm.org/symbols.html">http://lldb.llvm.org/symbols.html</a>.
  This has several drawbacks, including:</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">1) performance implications (~1000 modules are loaded, constantly in flux so the home-directory-based symlink cache isn't practical)</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">2) no runtime configurability (there doesn't appear to be a way to specify the script as an lldb startup argument, so I need to use the
 macos 'defaults' tool, and install it in the user's home directory, which means we can't have different scripts in use when debugging multiple different workspaces at the same time).</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);">3) no equivalent capability when using lldb on Linux</span></p>
<p><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);"><br>
</span></p>
<p>I've solved this problem on GDB using the Objfile.add_separate_debug_file() method in their python API: <a href="https://sourceware.org/gdb/onlinedocs/gdb/Objfiles-In-Python.html">https://sourceware.org/gdb/onlinedocs/gdb/Objfiles-In-Python.html</a><br>
</p>
<p><br>
</p>
<p>I've been scratching my head for a couple of days now.  Does this seem possible, and are there any suggestions for how to proceed?<br>
</p>
<p><br>
</p>
<p>Thanks,<br>
</p>
<p><br>
</p>
<p>Mike<br>
</p>
</body>
</html>