This is the mail archive of the gdb-patches@sourceware.org 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: set_value_component_location in apply_val_pretty_printer


Yao Qi wrote:
> On Fri, Oct 28, 2016 at 08:58:33PM +0200, Ulrich Weigand wrote:
> > But this isn't really correct either, since we need the
> > location of the *subobject*.  Now if the value resides
> > in inferior memory, we can get there simply by adding
> > the offset to the value address.  But that's not actually
> > correct for values with other location types.
> 
> I don't see why it is not correct to set the value's location to the same as
> the location of old.  The 'whole' object and 'component' object should have
> the same location with different offsets (internalvar is an exception since 
> the component's location is interanlvar_component), so
> set_value_component_location  looks right to me.

I think in the past we have avoided using value_offset for lval_memory
values for some reason.  It's been used only for values in registers
(or other non-memory values).  I'm not really sure why this is the
case -- maybe value_offset isn't always taken into account everywhere?

But maybe it is indeed the best way to use value_offset for creating
subobjects, and if there's any fallout, just fix that.  (In the 
alternative, we might use value_offset for non-lval_memory values,
and just increment the address for lval_memory ones ...).

B.t.w. I noticed that the bottom half of value_subscripted_rvalue
now looks very similar to your new value_from_component routine;
maybe it ought to be used there too.

Otherwise the patch looks good to me.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


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