Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: qiyaoltc@gmail.com (Yao Qi)
Cc: gdb-patches@sourceware.org (gdb-patches@sourceware.org)
Subject: Re: [PATCH 2/2] Remove parameter valaddr from la_val_print
Date: Mon, 07 Nov 2016 14:36:00 -0000	[thread overview]
Message-ID: <20161107143628.91FBF10B7A7@oc8523832656.ibm.com> (raw)
In-Reply-To: <CAH=s-PPSXN4D94TC8K8PmNambgo88is+A1Afd3uAmv2V_03N8Q@mail.gmail.com> from "Yao Qi" at Nov 07, 2016 02:24:54 PM

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


  reply	other threads:[~2016-11-07 14:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04 17:15 [PATCH 0/2] " Yao Qi
2016-11-04 17:15 ` [PATCH 1/2] use get_frame_register_value instead of deprecated_frame_register_read Yao Qi
2016-11-04 17:15 ` [PATCH 2/2] Remove parameter valaddr from la_val_print Yao Qi
2016-11-07 13:19   ` Ulrich Weigand
2016-11-07 14:24     ` Yao Qi
2016-11-07 14:36       ` Ulrich Weigand [this message]
     [not found] <86wpge87zz.fsf@gmail.com>
2016-11-08 14:01 ` Ulrich Weigand
2016-11-08 15:29   ` Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161107143628.91FBF10B7A7@oc8523832656.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox