Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <qiyaoltc@gmail.com>
To: Doug Evans <dje@google.com>
Cc: Yao Qi <qiyaoltc@gmail.com>,  gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 4/6] Fetch and store GP registers by PTRACE_{G,S}ETREGSET
Date: Fri, 29 May 2015 13:11:00 -0000	[thread overview]
Message-ID: <867frrplzb.fsf@gmail.com> (raw)
In-Reply-To: <CADPb22SBdBkrNPAg9s1RU0gF3Ob73v7XYdL-jDUNMRTm6OP5-w@mail.gmail.com>	(Doug Evans's message of "Thu, 28 May 2015 11:50:50 -0700")

Doug Evans <dje@google.com> writes:

> The == 1 in this test hinders readability (to me anyway).
> [It occurs here and in 5/6, 6/6.]
> The name suggests the variable is a boolean, so I'm
> left wondering "Can it have values other than 0/1,
> and is the else clause correct for those other values?"
>
> Digging deeper the reader would find the variable is tri-state,
> but the initial -1 value should never be seen here (at least
> that's the intuitive choice).

Yes, this variable have three states, uninitialised (-1), true (1)
and false (0) and that is reason I check "have_ptrace_getregset == 1"
instead of "have_ptrace_getregset".

>
> If one wanted to add an assert that the value is not -1 here
> that'd be ok, though one could also argue it's overkill.
> I don't have a preference either way.
>
> But I suggest removing the "== 1" in the test.

I am OK to remove "== 1" from patches #4, #5 and #6.

-- 
Yao (齐尧)


  reply	other threads:[~2015-05-29 13:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 14:20 [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Yao Qi
2015-05-28 14:20 ` [PATCH 4/6] Fetch and store GP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 18:50   ` Doug Evans
2015-05-29 13:11     ` Yao Qi [this message]
2015-05-28 14:20 ` [PATCH 2/6] Move have_ptrace_getregset to linux-nat.c Yao Qi
2015-05-28 14:20 ` [PATCH 1/6] Move PTRACE_GETREGSET and PTRACE_SETREGSET to nat/linux-ptrace.h Yao Qi
2015-05-28 14:20 ` [PATCH 5/6] Fetch and store FP registers by PTRACE_{G,S}ETREGSET Yao Qi
2015-05-28 14:20 ` [PATCH 6/6] Fetch and store VFP " Yao Qi
2015-05-28 14:20 ` [PATCH 3/6] Check whether kernel supports PTRACE_GETREGSET Yao Qi
2015-05-29  8:10 ` [PATCH 0/6] Use PTRACE_GETREGSET and PTRACE_SETREGSET in arm-linux-nat.c Gary Benson
2015-06-01 11:17 ` Yao Qi
2015-06-02  7:57   ` Mark Wielaard
2015-06-02  9:30     ` 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=867frrplzb.fsf@gmail.com \
    --to=qiyaoltc@gmail.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /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