[LLVMbugs] [Bug 5748] New: RFE: full dwarf debug info for JITed code

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Dec 10 05:08:18 PST 2009


http://llvm.org/bugs/show_bug.cgi?id=5748

           Summary: RFE: full dwarf debug info for JITed code
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Currently the JIT only creates dwarf unwind tables, and symbol names, which is
enough to get a backtrace in gdb but not much else.

I would like if the JIT would emit source file/line debug info, and variable
debug info.

Here's my suggestion towards implementing this:
1) DwarfDebug.cpp should be changed to not use AsmPrinter but rather use an API
that can both emit to an in-memory ELF (using ELFWriter), and to an assembly
file (when statically compiling).

Then JITDebugRegisterer could use it to create an ELF with source filename, and
line/column number debug info. 
This would already allow some JITed code to be debugged with gdb.

Next, debug info for the values of function arguments, and local variables
should be added to the JITed code, so that gdb in backtraces we can see what
the parameters are, and what their values are. 
DwarfDebug already supports this, if the values are on the stack AFAIK.
It should only be a matter of emitting the tables in memory rather than in asm
form to disk.

Sure variable debug info won't work with optimized code, but one could run
reg2mem to put the values on the stack for which DwarfDebug knows how to emit
debug info (or use -O0 that doesn't run mem2reg at all).

When DwarfDebug itself will support representing the value of not-stack
allocated variables (for example variables/arguments kept in registers), the
JITed code would automatically get that support too.

One issue is that currently JITDebugRegisterer creates one ELF file per
function, which is OK right now (might even be OK if only source/line number
debug info is added), but I think it would grow huge if for each
JITed function we emit all the type/macro/variables debug info again.
(a debug build of lli is 83M right now, I don't want to find out how big that
would if each function would be separate elf).

Perhaps we could emit multiple functions to the same ELF, i.e. when a new ELF
needs to be emitted we unregister the old ELF from gdb, add the new
function/debug info to it, and reregister the new ELF file.

2) Implement emission of source/line debug info (and variable debug info) using
ELFWriter. This could be a short term solution for the source/line debug info,
but it would just duplicate the functionality of DwarfDebug, and we'd still
have no debug info for variables on the stack and in registers.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list