[LLVMdev] Runtime introspection of "Release Mode" programs using LLVM or LLDB

Jonathan Roelofs jonathan at codesourcery.com
Mon Nov 3 07:19:47 PST 2014



On 10/29/14 7:54 PM, Kenneth Camann wrote:
> Hi everyone,
>
> 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.
You can probably find what you need in libunwind/libcxxabi. See: 
http://mentorembedded.github.io/cxx-abi/abi-eh.html


Cheers,

Jon
>
> 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?
>
> Thanks!
> Ken
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-- 
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded



More information about the llvm-dev mailing list