This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: set_value_component_location in apply_val_pretty_printer
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: qiyaoltc at gmail dot com (Yao Qi)
- Cc: user-agent at de dot ibm dot com;, bh=bRSZrFs7MDCHH9pBZWPVTfOSNPe/nJuj407ynYvPgXM=@de.ibm.com;, b=Ad2ef64JwNZkXMSBRIw9rjjbKD3TRg5+F7YP3OvdCo7XdZIOHnnX9P8Bq+YX6BV2SWCHunVt2nVkgOreg4Sj2rsH9OrG70EvWdRw3lMXWWl8e5E7+T17MKumAdjj+9kxYu1c5oc1/CeW7UG444M/MDt+GN+Db at gmail dot com, gdb-patches at sourceware dot org (gdb-patches at sourceware dot org), tom at tromey dot com (Tom Tromey)
- Date: Mon, 14 Nov 2016 17:38:32 +0100 (CET)
- Subject: Re: set_value_component_location in apply_val_pretty_printer
- Authentication-results: sourceware.org; auth=none
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