[lldb-dev] Debugging JIT-compiled code with LLVM
Simon Ask Ulsnes
simon at ulsnes.dk
Wed Nov 17 23:35:31 PST 2010
2010/11/18 Greg Clayton <gclayton at apple.com>:
> LLDB currently doesn't yet have any support for JIT'ed code, though I would be happy to work with you if you wanted to get that working in LLDB.
This was my fear. But I'll need some kind of debugger for my own
language anyway, so I'd be happy to implement this in LLDB.
Could you briefly outline the general steps necessary for adding
support for JIT'ed code? As you mention, I would expect the procedure
to look similar to how dlopen()ed dylibs are registered, but I might
GDB has a hook for JIT'ed code, but you are right that it only works
for ELF binaries. The approach there is that GDB sets a breakpoint in
an extern function, which LLVM calls when emitting code, giving GDB a
chance to load the symbols. Would a different approach in LLDB be
desirable, or does that seem OK to you?
According to the LLVMdev list, LLVM did not emit DWARF data for JIT'ed
code as of March 2009 — I'm not sure if this has changed, though I
suspect it hasn't, so to get this to work I guess there is also a bit
of work to be done on the LLVM side of things.
More information about the lldb-dev