This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [PATCH 06/10] vla: update type from newly created value

> -----Original Message-----
> From: Pedro Alves []
> Sent: Wednesday, November 20, 2013 11:30 AM
> To: Agovic, Sanimir
> Cc:
> 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

Intel GmbH
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]