This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Remove parameter valaddr from la_val_print
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: qiyaoltc at gmail dot com (Yao Qi)
- Cc: qiyaoltc at gmail dot com (Yao Qi), gdb-patches at sourceware dot org (gdb-patches at sourceware dot org)
- Date: Tue, 8 Nov 2016 15:01:22 +0100 (CET)
- Subject: Re: [PATCH 2/2] Remove parameter valaddr from la_val_print
- Authentication-results: sourceware.org; auth=none
Yao Qi wrote:
> If we go to the direction you suggested, val_print routines shouldn't
> assume that VAL contents are already fetched. Before we do printing,
> optimized-out checking, or available checking, we should make sure VAL
> is not lazy. Nowadays, we can't fetch the value partially, because
> 'lazy' is a bool attribute, we either fetched all contents or haven't
> fetch all contents.
Right. But if we ever went to actually create sub-value objects, then
we might be able to take advantage of only fetching the contents for
those sub-objects are actually printed. In any case, I still think
this new patch is preferable over calling value_fetch_lazy all the
time ...
> How is the patch below? I don't write the ChangeLog entry yet.
> Regression tested on x86_64-linux.
Looks good to me.
> --- a/gdb/extension.c
> +++ b/gdb/extension.c
> @@ -478,9 +478,9 @@ free_ext_lang_type_printers (struct ext_lang_type_print=
> ers *printers)
> xfree (printers);
> }
> =0C
> -/* Try to pretty-print a value of type TYPE located at VALADDR
> - + EMBEDDED_OFFSET, which came from the inferior at address ADDRESS
> - + EMBEDDED_OFFSET, onto stdio stream STREAM according to OPTIONS.
> +/* Try to pretty-print a value of type TYPE located at VAL's contents
> + buffer + EMBEDDED_OFFSET, which came from the inferior at address
> + ADDRESS + EMBEDDED_OFFSET, onto stdio stream STREAM according to OPTION=
> S.
> VAL is the whole object that came from ADDRESS. VALADDR must point to
> the head of VAL's contents buffer.
> Returns non-zero if the value was successfully pretty-printed.
This changes the comment but not the actual implementation, this seems
to be an oversight?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com