[LLVMdev] question on generating dwarf metadata

Bagel bagel99 at gmail.com
Mon Dec 6 12:50:10 PST 2010


On 12/06/2010 12:03 PM, Devang Patel wrote:
> As I understand, you are not interested in 'how to use DIFactory'. Do you want
> to know what are the fields of metadata to encode debug info for a local variable ?
> That'd be
>
> !7 = metadata !{
>    i32,      ;; Tag (see below)
>    metadata, ;; Context
>    metadata, ;; Name
>    metadata, ;; Reference to file where defined
>    i32,      ;; Line number where defined
>    metadata  ;; Type descriptor
> }
>
>
> -
> Devang

Correct: I'm not interested in 'how to use DIFactory', and yes, I do want to 
know what the fields of metadata encode in somewhat more detail.

For example, I am struggling with the 'DW_TAG_subroutine_type' now.  There is a 
field that is labeled:
     metadata, ;; Reference to array of member descriptors
Now I figured out that this array contains the types of the formal parameters, 
but it also appears the first (and only the first) in the array is the returned 
value type of the function.  Since LLVM supports functions that return multiple 
values (as does my language), and DW_TAG_subroutine_type implementation 
currently supports, at most, a single returned value, this might be a bug. 
Looking at the code in lib/CodeGen/AsmPrinter/DwarfDebug.cpp around line 1035, 
this does appear to be the case.

thanks, bagel



More information about the llvm-dev mailing list