[Dwarf-discuss] Encoding variant records: request for clarification.
Nettleton, Brian
brian.nettleton
Fri Aug 18 15:55:06 GMT 2006
The example in Appendix D section D.2.2 shows how to encode Data and
Name. Something like the following for the variant:
DW_TAG_structure_type
DW_AT_name "R"
1$: DW_TAG_member
DW_AT_name "N"
...
DW_TAG_variant_part
DW_AT_discr reference to 1$
DW_TAG_variant
DW_AT_discr_value 0
DW_TAG_member
DW_AT_name "Name"
[type info references 1$ like appendix example]
DW_TAG_variant
DW_AT_discr_list block DW_DSC_range 1 20
DW_TAG_member
DW_TAG_name "Id"
DW_TAG_member
DW_TAG_name "Port"
DW_TAG_variant
[this variant is empty]
-Brian Nettleton
> -----Original Message-----
> From: dwarf-discuss-bounces at lists.freestandards.org
> [mailto:dwarf-discuss-bounces at lists.freestandards.org] On
> Behalf Of Paul Hilfinger
> Sent: Friday, August 18, 2006 1:11 AM
> To: dwarf-discuss at lists.freestandards.org
> Subject: [Dwarf-discuss] Encoding variant records: request
> for clarification.
>
>
> I'm finding the description of variants a little difficult to
> interpret and apply, and I wonder if someone could supply me with an
> example. Let's consider specifically the Ada record type R,
> defined
>
> type R (N : Integer) is record
> Data : String (1 .. N);
> case N is
> when 0 =>
> Name : String (1 .. N);
> when 1..20 =>
> Id, Port : Integer;
> when others =>
> null;
> end case;
> end record;
>
> N here is basically a member of R. As you can see, it is referred to
> in Data. According to the standard, however, there is ALSO a child of
> the variant part for N. What is the relationship between the two (the
> child of R representing N and the child of the variant child of R
> representing N)? How exactly is type R to be encoded?
>
> Thanks in advance.
>
> Paul Hilfinger
> AdaCore, Inc. & UC Berkeley
>
>
>
>
> _______________________________________________
> Dwarf-discuss mailing list
> Dwarf-discuss at lists.freestandards.org
> http://lists.freestandards.org/mailman/listinfo/dwarf-discuss
>
More information about the Dwarf-discuss
mailing list