[lldb-dev] LLDB support for python scripts in ELF section, like .debug_gdb_scripts in GDB
Greg Clayton via lldb-dev
lldb-dev at lists.llvm.org
Thu Oct 20 11:10:31 PDT 2016
We currently have the ability to support this for ELf. It is only currently hooked up for Mach-O binaries when you have a dSYM (stand alone debug info bundle). You will want to implement this for your platform:
FileSpecList
Platform::LocateExecutableScriptingResources(Target *target, Module &module,
Stream *feedback_stream) {
return FileSpecList();
}
So given an LLDB Module (executable/shared library), find any python files that should be imported. You can take a look at what we do in PlatformDarwin:
PlatformDarwin::LocateExecutableScriptingResources()
Basically it sees if the module has a stand alone debug file, and if it does, it looks for scripting resource files that will be imported. In our case we might have and module whose path is "/tmp/a.out", we ask the symbol vendor to get the symbol file ("/tmp/a.out.dSYM"), and if it has one, this file is a bundle. Inside of this bundle we look for a "a_out.py" that is relative to the file. If that file exists, it will be pulled in automatically.
So this is possible to implement for other platforms. Seems like you can have ".debug_lldb_python_scripts" section that could specify a relative (relative to the ELF file itself) or absolute path to scripting files that should be loaded when this binary gets loaded. So that shouldn't be too hard to implement.
Let me know if you have any questions.
Greg
> On Oct 4, 2016, at 8:02 AM, Richard Geary via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>
> Has LLDB considered adding per-binary support for LLDB python scripts,
> eg. for adding custom type summaries?
>
> This is the equivalent GDB feature
> https://sourceware.org/gdb/onlinedocs/gdb/dotdebug_005fgdb_005fscripts-section.html
>
> GDB can load a custom python script from either a side-installed file
> or an ELF section. This allows debugging of multiple binaries with
> different implementations of the pretty-printer.
>
> Any suggestions for LLDB workarounds would be welcome.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
More information about the lldb-dev
mailing list