Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Maciej W. Rozycki" <macro@codesourcery.com>
Subject: Re: [PATCH] remote: Fix hw watchpoint address matching
Date: Wed, 07 Dec 2011 17:55:00 -0000	[thread overview]
Message-ID: <201112071724.06407.pedro@codesourcery.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1111301733090.4191@tp.orcam.me.uk>

On Wednesday 30 November 2011 18:23:35, Maciej W. Rozycki wrote:
>  
> +static int
> +remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr,
> +				     CORE_ADDR start, int length)
> +{
> +  CORE_ADDR diff = remote_address_masked (addr - start);
> +
> +  return diff >= 0 && diff < length;
> +}

CORE_ADDR is unsigned.  `>= 0' is always true.

Wouldn't it be much more readable to:

{
  CORE_ADDR start = remote_address_masked (start);

  return start <= addr && addr < start + length;
}

?

(assuming addr is already masked, since that was the address
the target reported.)

-- 
Pedro Alves


  reply	other threads:[~2011-12-07 17:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 18:24 Maciej W. Rozycki
2011-12-07 17:55 ` Pedro Alves [this message]
2011-12-07 23:36   ` Maciej W. Rozycki
2011-12-09 14:34     ` Pedro Alves
2012-02-25  1:54       ` Maciej W. Rozycki
2012-03-06 18:56         ` Pedro Alves
2012-03-06 20:20           ` Maciej W. Rozycki

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=201112071724.06407.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@codesourcery.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