This is the mail archive of the
mailing list for the GDB project.
RE: [PATCH 06/10] vla: update type from newly created value
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: 'Pedro Alves' <palves at redhat dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 20 Nov 2013 12:46:28 +0000
- Subject: RE: [PATCH 06/10] vla: update type from newly created value
- Authentication-results: sourceware.org; auth=none
- References: <1382366424-21010-1-git-send-email-sanimir dot agovic at intel dot com> <1382366424-21010-7-git-send-email-sanimir dot agovic at intel dot com> <528C8F1E dot 2080309 at redhat dot com>
> -----Original Message-----
> From: Pedro Alves [mailto:email@example.com]
> Sent: Wednesday, November 20, 2013 11:30 AM
> To: Agovic, Sanimir
> Cc: firstname.lastname@example.org
> Subject: Re: [PATCH 06/10] vla: update type from newly created value
> On 10/21/2013 03:40 PM, Sanimir Agovic wrote:
> > Constructing a value based on a type and address might change the type
> > of the newly constructed value.
> OOC (and for the archives), why's that? Where does that occur?
Since dwarf3 certain attributes e.g upper/lower bound may be computed
dynamically. To support such attributes with the current gdb type-system
we require such types to be "normalized". This means types with dynamic
properties are converted to types with static properties.
To successful convert a type with dynamic properties into one with static
properties access to inferior memory is needed. Therefore we hooked into
the following value constructors
as they require an inferior address in addition to a type to instantiate
a value. IIF the passed type has dynamic properties we resolve the bounds
and thus change the type.
Given the following statement:
struct value *val = value_at (my_vla_type, at_address);
Before this was always true:
TYPE_LENGTH (value_type (val)) == TYPE_LENGTH (my_vla_type)
This is not the case after applying this (vla-c00) patch series. Type
normalization is done in the mentioned value constructors and might
change the value type, therefore we need to re-fetch the type from
the constructed value.
I hope this makes sense.
> > Thus re-fetch type via value_type to ensure
> > we have the correct type at hand.
> Pedro Alves
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052