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.
Libraries without debugging symbols:
Corresponding debugging symbols:
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:
performance implications (~1000 modules are loaded, constantly in flux so the home-directory-based symlink cache isn’t practical)
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).
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?