I can't seem to find any good documentation for the DWARF DI format to answer my question. I'm writing a language that compiles to C, is there any way that I can produce DWARF Debug Information into the C code or is it assembly only?
Is it impossible to add debug information to some (generated) C code other than using primitive stuff that isn't as good like #line
and the #file
directives?
Tom Tromey :
It can be done for some things, if you assume your compiler can emit assembly. For an example of this, see my favorite gdb test case.\n\nNormally this isn't done, though. It can be quite hard to get right. Nowadays it's better to either write your compiler to be a direct front-end to GCC or LLVM; or to write gdb or lldb helper scripts to make debugging the generated C code simpler.",
2016-10-08T02:15:21