[LLVMbugs] [Bug 13171] New: JITEmitter no longer registers symbols with GDB

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 21 17:55:23 PDT 2012


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

             Bug #: 13171
           Summary: JITEmitter no longer registers symbols with GDB
           Product: libraries
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Generic Execution Engine Support
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nipunn1313 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In LLVM2.9, JITEmitter::finishFunction used to emit debug information to be
consumed by GDB, thus making any JIT written using LLVM automatically
gdb-debuggable. Specifically, it would call:

DR->RegisterFunction(F.getFunction(), I)

I understand the infrastructure for this is gone with the reorganizations, but
gdb symbols would be fantastic. I was able to hack together gdb support for my
JIT by registering a callback when a function was emitted. In that callback, I
had to format my own ELF file in memory and register it manually with GDB. I
adapted much of it from LLVM2.9 actually. Seems silly, considering LLVM3.1 has
the capability to do this, yet doesn't.

Furthermore, to get good backtraces, I needed the exception handling frame
which was emitted in finishFunction AFTER the callback. The callback also had
no idea where finishFunction had placed the frame. I patched LLVM to move the
call to the callback after the EH frame was emitted (all in
JITEmitter::finishFunction()). Then, I searched through memory blindly from the
end of the code looking for something shaped like an exception table.
Definitely a hack, but I got my symbols.

I open this bug because none of what I did should ever be necessary. I believe
several things should happen.
1) The callback to TheJIT->NotifyFunctionEmitted() should happen after
exception tables are written to memory
2) The callback should be optionally be given the address of the exception
table
3) (and most important), if  TargetOptions.JITEmitDebugInfo is set, then
JITEmitter::finishFunction should definitely register with GDB! Like it used to
in 2.9! The information it needs is right there.

Thank you.

-- 
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