[PATCH] DebugIR with no existing debug information

Malea, Daniel daniel.malea at intel.com
Thu Jun 20 15:47:19 PDT 2013


Hi all,

I implemented a pass a little while ago that enabled stepping through LLVM IR in a debugger, but it was limited to code that had existing DebugInfo (so, generated by clang –g). This latest patch fixes that limitation by enabling DebugIR to generate source-line debug information (using DIBuilder) for any module. Also, by not depending on pre-generated debug-information, and by not forcing the pass to generate a new IR file, the tests have been improved as well!

If anyone wants to give the pass a shot, the easiest way is now via the lli tool, MCJIT, and GDB (7.1+):

$ gdb ./build/lli -use–mcjit -debug–ir my-llvm-ir-file.ll
(gdb) b main
(gdb) run
// break on lli main
(gdb) continue
// break on my-llvm-ir-file main() function

If you do try it out, or have a moment to review it, let me know what you think!

Patch #1: Remove dependence on existing debug information in DebugIR
- use DIBuilder to generate missing debug information
- generate DICompileUnit per Module (if missing)
- generate DISubroutine per Function (if missing)
- made the DebugIR class more flexible so users can choose if they want an IR file generated
- add lli line flag "-debug-ir"

Patch #2: Tests for DebugIR pass
- re-generated all .ll files with no –g flag to clang
- added inline CHECK and CHECK-NEXT statements to check for source line DebugLoc metadata

If anyone wants, I can easily turn this into a phabricator review as well.


Cheers,
Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_ir_implementation.patch
Type: application/octet-stream
Size: 31430 bytes
Desc: debug_ir_implementation.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130620/7e92d47d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_ir_tests.patch
Type: application/octet-stream
Size: 25781 bytes
Desc: debug_ir_tests.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130620/7e92d47d/attachment-0001.obj>


More information about the llvm-commits mailing list