From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26641 invoked by alias); 7 Dec 2011 17:24:39 -0000 Received: (qmail 26606 invoked by uid 22791); 7 Dec 2011 17:24:35 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Dec 2011 17:24:11 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RYLE1-00061u-WB from pedro_alves@mentor.com for gdb-patches@sourceware.org; Wed, 07 Dec 2011 09:24:10 -0800 Received: from scottsdale.localnet ([172.30.7.53]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 7 Dec 2011 17:24:08 +0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [PATCH] remote: Fix hw watchpoint address matching Date: Wed, 07 Dec 2011 17:55:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-13-generic; KDE/4.7.2; x86_64; ; ) Cc: "Maciej W. Rozycki" References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112071724.06407.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00233.txt.bz2 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