[LLVMdev] question on generating dwarf metadata

Devang Patel dpatel at apple.com
Fri Dec 10 11:23:22 PST 2010


On Dec 6, 2010, at 12:50 PM, Bagel wrote:

> 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.

Indeed, it is a bug/missing feature. Please file a bugzilla PR to track this. One approach to solve this would be to use DIArray as return type in case of multiple return values.

-
Devang



More information about the llvm-dev mailing list