[cfe-dev] Debug Info Generation in Clang.

Sanjiv.Gupta at microchip.com Sanjiv.Gupta at microchip.com
Fri Apr 25 10:12:11 PDT 2008


> To get started, I'd suggest beginning with simple line number 
> information.  When you can emit the llvm.dbg.stoppoint 
> intrinsics (and the metadata that describes translation units 
> etc) you should be able to step through a program with GDB.  
> After that, I'd tackle variable/function descriptors, type 
> descriptors, etc.

Llvm-gcc uses TreeToLLVM class to generate code for a function.
The Emit(tree exp, const MemRef *DestLoc) method of that class handles
code generation for expressions and also emits the stoppoint intrinsics
as the first thing. 

I see that the corresponding place in clang is
CodeGenFunction::EmitScalarExpr (const Expr *E).
We can get the getExprLoc() from the Expr and use it to set the
SourceLocation (File, Line) of the CodeGenDebugInfo instance everytime
we emit an intrinsic.

Am I looking at the right places? Opinions welcome.

- Sanjiv





More information about the cfe-dev mailing list