[LLVMdev] Runtime introspection of "Release Mode" programs using LLVM or LLDB
kjcamann.lists at gmail.com
Wed Oct 29 18:54:34 PDT 2014
I'm working on a library for runtime introspection of C++ programs, for
example, getting stack traces, decorating logs with source file
information, etc. It currently uses LLVMObject and LLVMDebugInfo.
There's a feature I want to add, but it requires that I understand where on
the stack local variables are located.
For this to work on x86-64, I would need to do whole "virtual unwinding"
thing, i.e., create a library that can understand the DWARF call frame
information. This is something that I do not want to do myself, because I
would never have the resources to maintain it. LLVM and or LLDB must have
code for doing this already though.
In fact, since this sort of dynamic inspection is kind of like debugging, I
originally thought LLDB would work better in the first place. I actually
tried early on to use LLDB, but I gave up quickly. The API seems to be
designed so that you must always attach one process to another, using an
operating system facility like ptrace.
That is not really compatible with the idea of the program inspecting
_itself_, although I think there is definitely a place for that, e.g.
portable stack traces, source info without the need for __FILE__ and
__LINE__ boilerplate, etc.
Does LLDB support anything like this, and I just didn't find it? Or going
another route, is there any plan for the DWARF classes in LLVMDebugInfo to
ever support APIs for understanding the call frame info?
If neither, any advice on what I should do?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev