This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Add type support for Ada
- From: Jim Blandy <jimb at redhat dot com>
- To: Hilfinger at otisco dot mckusick dot com
- Cc: ac131313 at redhat dot com, aidan at velvet dot net, drow at mvista dot com, per at bothner dot com, green at redhat dot com, muller at cerbere dot u- dot strasbg dot fr, gdb-patches at sources dot redhat dot com
- Date: 02 Oct 2002 13:41:27 -0500
- Subject: Re: [RFA] Add type support for Ada
- References: <20020926040044.I32211@velvet.net> <3D93C161.2070409@redhat.com><vt2k7l7b46m.fsf@zenia.red-bean.com><200209280925.CAA10025@otisco.McKusick.COM>
"Paul N. Hilfinger" <hilfingr@otisco.mckusick.com> writes:
> > It looks to me as if the string cleanup stuff is distinct from the
> > fixed instance stuff. These should be submitted as separate patches.
>
> They definitely are logically separate changes.
>
> > Is a `fixed instance' a feature of the language's type system itself?
> > That is, is it something that an Ada programmer actually knows about?
> > Or is it something used internally within GDB, or internally by some
> > implementations of Ada?
>
> It is not a language feature, but rather an optimization. The original
> problem was that STABS and also GDB's internal type representation
> was not adequate for representing "dynamic" Ada types---i.e., those that,
> unlike C types, have data-dependent sizes. The scheme we hit on (in
> retrospect perhaps not the best) was to encode a bunch of auxiliary
> information into our type names, and to introduce additional types
> carrying additional (encoded) information.
>
> When Ada evaluation routines discover that a quantity has an encoded
> type, they know to compute a conventional, fixed-sized GDB type based on the
> data, and to attach this type to the value they are producing.
>
> Unfortunately, the computations involved are expensive---involving type
> lookups in some cases---and we don't want to repeat them unnecessarily.
> Hence the flag.
Thanks for the explanation. Since this isn't a language feature, but
an implementation detail, the patch needs to add comments that explain
it in full detail. Something like the above, but with the exact Ada
terminology stuck in at the right places, would be a start.