Newbie question(?): How to correctly create debug info, when generating IR

Hello all,

Summary & Context:

  Hello all,

Summary& Context:
  I am starting to write a front-end for some domain specific programming
languages. Code generation seems to be working fine.

  However, I am having trouble generating debug info, to be used by gdb.

I've has some issues with debug info and it was pointed out to me that llvm can emit dwarf4 bits that gdb may not like, this may not help but I needed to pass:

-mllvm -use-dwarf3-form-flags

to get output gdb would accept.


Easiest way is to look at how clang generates debug info. See clang/lib/CodeGen/CGDebugInfo.cpp.