[Dwarf-Discuss] DWARF representation for Fortran descriptors

Kendrick Wong kendrick at ca.ibm.com
Fri Oct 29 11:07:55 PDT 2010


The descriptor for obj1 and obj2 in this example
 INTEGER, POINTER :: obj1
 INTEGER, ALLOCATABLE :: obj2

is similar to the array example in D.2.1.  In that the we have obj1 
containing the address of the descriptor, and the descriptor would carry 
the address of the raw data.

According to D.2.1, the DWARF would look like this:

$1a: DW_TAG_base_type
       DW_AT_name (INTEGER)
       DW_AT_encoding (DW_ATE_signed)
       DW_AT_data_location (...)  // address of raw data
       DW_AT_associated (...)     // is associated?
       DW_AT_allocated (...)      // is allocated?
$2a: DW_TAG_variable
       DW_AT_name (obj1)
       DW_AT_type ($1a)
       DW_AT_location (...)  // address of descriptor
$3a: DW_TAG_variable
       DW_AT_name (obj2)
       DW_AT_type ($1a)
       DW_AT_location (...)  // address of descriptor

My question is:  Since the type is shared by both obj1 and obj2, how would 
consumer know that obj1 is a pointer and obj2 is an allocatable?

Kendrick Wong



From:   John DelSignore <John.DelSignore at roguewave.com>
To:     Ron Brender <ron.brender at charter.net>
Cc:     Kendrick Wong/Toronto/IBM at IBMCA, 
"dwarf-discuss at lists.dwarfstd.org" <dwarf-discuss at lists.dwarfstd.org>
Date:   10/28/2010 05:37 PM
Subject:        Re: [Dwarf-Discuss] DWARF representation for Fortran 
descriptors



Also, from the debugger implementor perspective, it would help to know how 
the compiler represents the objects before giving advice on what the DWARF 
should look like.

Usually, descriptors are used for array objects, but unless Kendrick's 
example is incomplete, it appears that the objects are pointer/allocatable 
scalars. (IIRC, that might be a Fortran 2003 extension.)

If the compiler uses a trimmed-down array descriptor object to represent 
pointer/allocatable scalars, then the way it should be represented in 
DWARF is probably different than if the compiler uses a C/C++ pointer 
object (like an "int *").

Cheers, John D.


Ron Brender wrote:
> Kendrick,
> 
> Take a look at Appendix D.2.1. Hopefully that will answer your question. 

> If not, try some more specific questions...
> 
> Ron
> 
> -------------------------------------------
> On 10/28/2010 5:09 PM, Kendrick Wong wrote:
>> How are Fortran descriptors represented in DWARF?
>>
>> Take this program, for example:
>>
>> INTEGER, POINTER :: obj1
>> INTEGER, ALLOCATABLE :: obj2
>>
>> What is the correct way to represent obj1, obj2 and their types?
>>
>> $1a: DW_TAG_base_type
>> DW_AT_name (INTEGER)
>> DW_AT_encoding (DW_ATE_signed)
>> DW_AT_associated (...)
>> DW_AT_allocated (...)
>>
>> $2a: DW_TAG_variable
>> DW_AT_name (obj1)
>> DW_AT_type ($1a)
>> DW_AT_location (...)
>>
>> $3a: DW_TAG_variable
>> DW_AT_name (obj2)
>> DW_AT_type ($1a)
>> DW_AT_location (...)
>>
>> or
>>
>> $1b: DW_TAG_base_type
>> DW_AT_name (INTEGER)
>> DW_AT_encoding (DW_ATE_signed)
>>
>> $2b: DW_TAG_pointer_type
>> DW_AT_associated (...)
>> DW_AT_type ($1b)
>>
>> $3b: DW_TAG_pointer_type
>> DW_AT_allocated (...)
>> DW_AT_type ($1b)
>>
>> $4b: DW_TAG_variable
>> DW_AT_name (obj1)
>> DW_AT_type ($2b)
>> DW_AT_location (...)
>>
>> $5b: DW_TAG_variable
>> DW_AT_name (obj2)
>> DW_AT_type ($3b)
>> DW_AT_location (...)
>>
>> Or another way?
>>
>> Kendrick Wong
>>
>>
>>
>> _______________________________________________
>> Dwarf-Discuss mailing list
>> Dwarf-Discuss at lists.dwarfstd.org
>> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20101029/0a8dff14/attachment-0002.htm>


More information about the Dwarf-Discuss mailing list