Paul,
Thank you for your answer.
On 05/14/2014 09:48 PM, Robinson, Paul wrote:
struct record_type {
int n;
int a[1 .. max(n, 0)];
};
I had to do something like this for a COBOL compiler once, except
it was simply [1 .. N] and so I had the upper bound be a reference
to the member DIE for N. If you're computing an expression on N
then yes it's more complicated.
Agreed.
On the other hand, getting the address of the "A" member would not
be sufficient: in more complex cases, the offset of the "A" member
can depend on discriminants!
Does that mean the offset between "A" and "N" is not constant?
You'd have to produce a sub-expression to compute that offset...
This sounds complicated but not infeasible.
When I started to work on this matter, I thought about the following Ada
type declaration:
type Record_Type2 (N : Integer) is record
A1 : Array_Type (1 .. N);
A2 : Array_Type (1 .. N);
end record;
The corresponding memory layout would be as follows:
struct record_type2 {
int n;
int a[1 .. max(n, 0)];
int b[1 .. max(n, 0)];
};
In this case indeed, the offset between the "n" field and the "b" one is
not constant, and I can't find a way to compute it from the
DW_AT_upper_bound attribute of the DW_TAG_subrange_type DIE
corresponding to "b". The point is that this offset depends on the "n"
field and if we had its value, we would not need to compute this offset
in the first place.
--
Pierre-Marie de Rodat
_______________________________________________
Dwarf-Discuss mailing list
Dwarf-Discuss@lists.dwarfstd.org
http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org