[Dwarf-Discuss] DWARF representation for Fortran descriptors

Kendrick Wong kendrick at ca.ibm.com
Fri Oct 29 15:02:58 PDT 2010


In this example, duplicating the base types does not significantly 
increase the debug data size.  But if the type is a more complex, then the 
cost of duplication can be quite significant.

In my original email, I suggested adding additional DW_TAG_pointer_type 
DIEs:

$2b: DW_TAG_pointer_type
      DW_AT_associated (...)
      DW_AT_type ($1b)

$3b: DW_TAG_pointer_type
      DW_AT_allocated (...)
      DW_AT_type ($1b)

both carry either DW_AT_associated or DW_AT_allocated, and would point to 
the same type.  The DW_TAG_pointer_type is essentially a dummy entity to 
avoid having to duplicate the type.  To me the fortran descriptor does act 
similar to a C/C++ pointer, so I borrowed the concept here.  But I'm 
wondering if this kind of usage is appropriate.  The other question I have 
with this approach is, where should the DW_AT_data_location go in this 
case?

Kendrick Wong 



From:   David Anderson <davea42 at earthlink.net>
To:     Kendrick Wong/Toronto/IBM at IBMCA
Date:   10/29/2010 05:29 PM
Subject:        Re: [Dwarf-Discuss] DWARF representation for Fortran 
descriptors



On 10/29/2010 11:07 AM, Kendrick Wong wrote:
> 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?
>
...
>
> 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?

DW_AT_allocated and DW_AT_associated give instructions on how to read 
the (object-dependent)
descriptor value so one can know if the type instance is allocated or 
associated.

DWARF4 D.2 (page 254 printed on that page) shows this.  Fine so far.

However, because of the way 5.14.2 reads, the example provided  is 
incorrect in
having a single DW_TAG_base_type shared by obj2 and obj1.

I believe the above example requires two base types, one with only 
DW_AT_associated and
one with only DW_AT_allocated.

DavidA.






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


More information about the Dwarf-Discuss mailing list