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: [PATCH 2/2] Remove parameter valaddr from la_val_print


Yao Qi wrote:
> On Mon, Nov 7, 2016 at 1:18 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> > Yao Qi wrote:
> >
> >> Nowadays, we pass both val and return value of
> >> value_contents_for_printing (val) to la_val_print.  The latter is
> >> unnecessary.  This patch removes the second parameter of la_val_print,
> >> and get valaddr in each language's implementation by calling
> >> value_contents_for_printing_const.  This change makes a little
> >> difference, because value_contents_for_printing calls value_fetch_lazy
> >> additionally, so I call value_fetch_lazy in the caller of val_print
> >> if needed.
> >
> > Can you explain why all those value_fetch_lazy calls are needed?
> > Did you add them only to keep the behavior the same as currently,
> > or does printing not work correctly if they are omitted?
> >
> 
> The former.  Without my change, we pass the return value of
> value_contents_for_printing to val_print, like this,
> 
>          val_print (elttype, value_contents_for_printing (v0),
> 
> and, value_contents_for_printing calls value_fetch_lazy.  After my
> change, we start to use value_contents_for_printing_const in val_print
> of each language, because VAL passed to val_print is const, so we
> need to call value_fetch_lazy explicitly in the caller of val_print.

Ah, I didn't notice the "const".  Maybe the right fix would then be
to simply remove the "const" (the value parameter in value_print
isn't const either), and simply use value_contents_for_printing
wherever needed.

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]