[LLVMdev] Debug info generation through llvm backend

Devang Patel dpatel at apple.com
Tue Feb 8 10:51:31 PST 2011


On Feb 6, 2011, at 8:52 PM, sivakumar srinivasan wrote:

> Hi Everyone,
>  
> I am really new to LLVM. I am working on something where I had to pick-up a half-cooked backend and need to add debug support to it. I have searched through messages but could not find a nice starting place. Could some one please provide me with some pointers about
> - what is already supported in llvm as far as emitting debugging information is concerned?
> - how to emit debug information through a llvm backend (any step-by-step process)?
> - any existing implementation?

x86, ARM etc.. backends now emit debug info in DWARF format. To understand how it works, follow how @llvm.dbg.declare and @llvm.dbg.value intrinsics are lowered, at instruction selection time, from LLVM IR into machine instructions.

Most of the work required here is target independent (note, DWARF format is also used to encode EH info, which is a separate story). Target independent AsmPrinter does bulk of the work  (see DwarfDebug.cpp and AsmPrinter.cpp). The ongoing MC work is moving some of the printing stuff into MC world, where target specific support is required to support respective object file format.

You may need to  
- enable certain flags for your target, see TargetLoweringObjectFile.h
- provide a dwarf register map, see Target.td and TargetRegisterInfo.h

> - also, how to search through mailing list archives?

?

-
Devang





More information about the llvm-dev mailing list