This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] remote: Fix hw watchpoint address matching
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Date: Wed, 7 Dec 2011 17:24:06 +0000
- Subject: Re: [PATCH] remote: Fix hw watchpoint address matching
- References: <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