Hi lldb-dev,

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.


For example,


Libraries without debugging symbols:

/path/to/my/workspace/bin/maci64/libA.dylib

/path/to/my/workspace/bin/maci64/libB.dylib

/path/to/my/workspace/bin/maci64/libC.dylib

Corresponding debugging symbols:

/archive/builds/1234/bin/maci64/libA.dylib.dSYM/Contents/Resources/DWARF/libA.dylib

/archive/builds/2345/bin/maci64/?libB.dylib.dSYM/Contents/Resources/DWARF/libB.dylib

/archive/builds/3456/bin/maci64/?libC.dylib.dSYM/Contents/Resources/DWARF/libC.dylib


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.


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.


I've looked at locate_module_and_debug_symbols() in 
lldb.utils.symbolication.Image (as mentioned here: 
http://lldb.llvm.org/symbolication.html).  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.


I've also looked at the DBGShellCommands described here: 
http://lldb.llvm.org/symbols.html.  This has several drawbacks, including:

1) performance implications (~1000 modules are loaded, constantly in flux so 
the home-directory-based symlink cache isn't practical)

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).

3) no equivalent capability when using lldb on Linux


I've solved this problem on GDB using the Objfile.add_separate_debug_file() 
method in their python API: 
https://sourceware.org/gdb/onlinedocs/gdb/Objfiles-In-Python.html


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?


Thanks,


Mike
_______________________________________________
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

Reply via email to