This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: plan: VLA (Variable Length Arrays) and Fortran dynamic types
- From: Tom Tromey <tromey at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 29 Nov 2012 14:51:07 -0700
- Subject: Re: plan: VLA (Variable Length Arrays) and Fortran dynamic types
- References: <20121129144855.GA16288@host2.jankratochvil.net>
>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
Jan> Rename "struct type" to "struct abstract_type". Make all
Jan> TYPE_LENGTH, TYPE_ARRAY_UPPER_BOUND_VALUE etc. macros accessing
Jan> concrete sizes requiring to provide also "struct value *". Remove
Jan> check_typedef, that is hide it under the TYPE_LENGTH etc. macros.
Jan> This would also include work to pass "struct value *" mostly
Jan> everywhere instead of where current "struct type *" is passed as
Jan> one needs the inferior memory to find out the concrete dimensions
Jan> of inferior type. This then makes the current *-vla implementation
Jan> of DW_AT_object_pointer easy.
[...]
Jan> Alternative approach would be to "concretize" abstract types by
Jan> check_typedef (which would be kept there). In such case there
Jan> still would be "struct abstract_type" but there would be also
Jan> "struct concrete_type" which would automatically cache all the
Jan> values for better performance. check_typedef would still be
Jan> impossible to forget like nowadays due to the non-compatible GDB
Jan> types "struct abstract_type" vs. "struct concrete_type".
Jan> archer-jankratochvil-vla does it this way (but still keeping
Jan> "struct type" being both the input and output GDB type of
Jan> check_typedef). I do not think this approach is worth the pain.
Passing a struct value everywhere seems pretty awful though too,
especially considering that one may not generally have a value.
'ptype' and plenty of other things have to work on the abstract type.
But I think maybe I don't understand some details here. Could you give
an example of where we pass a type now that we would have to pass a
value in the future?
I note that Ada already uses the concretizing approach.
Maybe Joel could share their experiences with this.
Tom