From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15034 invoked by alias); 4 Dec 2007 21:07:04 -0000 Received: (qmail 14960 invoked by uid 22791); 4 Dec 2007 21:07:03 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (213.8.233.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Dec 2007 21:06:47 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-229-222-88.inter.net.il [84.229.222.88]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id JNW37912 (AUTH halo1); Tue, 4 Dec 2007 23:05:40 +0200 (IST) Date: Tue, 04 Dec 2007 21:07:00 -0000 Message-Id: From: Eli Zaretskii To: Jim Blandy CC: msnyder@specifix.com, gdb@sourceware.org In-reply-to: (message from Jim Blandy on Tue, 04 Dec 2007 09:23:52 -0800) Subject: Re: Watchpoints with condition Reply-to: Eli Zaretskii References: <200711301925.20196.vladimir@codesourcery.com> <20071130234853.GA27583@caradoc.them.org> <1196744257.2501.268.camel@localhost.localdomain> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-12/txt/msg00030.txt.bz2 > Cc: Eli Zaretskii , gdb@sourceware.org > From: Jim Blandy > Date: Tue, 04 Dec 2007 09:23:52 -0800 > > I guess I don't see why 'GDB stops your program whenever the value of > this expression changes' is hard to understand. Two reasons: (1) most people think watchpoints watch variables, not expressions; and (2) the notion of "foo == 1" being an expression whose value is either 1 or zero is natural only to C hackers. > Explaining conditional watchpoints is a superset of explaining > watchpoints, so I don't see how it could be simpler. It is simpler because you still watch a simple variable, and the condition is kept separately. It is similar to x = y + (foo == 1); vs if (foo == 1) x = y + 1; else x = y; The latter shows what the code does more clearly (and in fact some coding standards advise against the former style).