[Dwarf-discuss] Encoding variant records: request for clarification.

Paul Hilfinger hilfingr
Sat Aug 19 10:05:19 GMT 2006


Evidently, I did not make the source of my confusion sufficiently clear.
Again, the type in question is

     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;

Both responders said essentially the same thing, viz.,

> I think the answer to this question is covered by the example type REC2 
> presented in D.2.2. See Figure 53 on p197 in particular. The key point, 
> I think, is that there is only one entity named N and the other uses of 
> N are references to it.

Yes, I saw that section, and it's nice as far as it goes.  However, my
issue was with the treatment of N in "case N is" part.  The Dwarf 3 
standard says (5.6.9, pg. 79):

    If the variant part has a discriminant, the discriminant is represented
    by a separate debugging information entry which is a ->>CHILD OF THE 
    VARIANT PART ENTRY.<<- ... The variant part entry will have a 
    DW_AT_discr attribute whose value is a reference to the member entry
    for the discriminant.

So field N would be a child of the variant_part representing 

   case N is ... end case

But N is ALREADY a child of the structure_type (or whatever) that represents

    type R (N: Integer) is record ... end record;

So what gives?

Thanks for your help.

Paul Hilfinger





More information about the Dwarf-discuss mailing list