From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7951 invoked by alias); 3 Dec 2007 20:59:53 -0000 Received: (qmail 7934 invoked by uid 22791); 3 Dec 2007 20:59:52 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (213.8.233.22) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Dec 2007 20:59:43 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-229-118-220.inter.net.il [84.229.118.220]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id ILW56791 (AUTH halo1); Mon, 3 Dec 2007 22:57:03 +0200 (IST) Date: Mon, 03 Dec 2007 20:59:00 -0000 Message-Id: From: Eli Zaretskii To: Jim Blandy CC: gdb@sourceware.org In-reply-to: (message from Jim Blandy on Mon, 03 Dec 2007 09:54:41 -0800) Subject: Re: Watchpoints with condition Reply-to: Eli Zaretskii References: <200711301925.20196.vladimir@codesourcery.com> <20071130234853.GA27583@caradoc.them.org> 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/msg00014.txt.bz2 > From: Jim Blandy > Date: Mon, 03 Dec 2007 09:54:41 -0800 > > Okay, so 'watch foo if foo == 1' has some interesting behavior: > - if foo is 1 when the watchpoint is set, then the watchpoint doesn't > trigger until foo becomes != 1, and then becomes 1 again. > - If foo is != 1 when the watchpoint is set, then the command is > equivalent to watch foo == 1. > > The first case seems really obscure; I assumed that wasn't what Eli > was using conditional watchpoints for "quite a lot". Right. You can "set foo = something that is not 1", before starting to watch like that. But that's normally not a problem in real life, because this use case is for catching writes of _rare_ values, not frequent ones. > I think the only valuable use case for conditional watchpoints is the > one you mentioned, where Y is something expensive, and X is some > cheaper conservative approximation to the condition we really want. Well, you are wrong (and Daniel explained one reason why). Believe me, this use case is very useful and important. (Actually, it was one of the main reasons I got involved with fixing x86 hardware watchpoints at the time: I needed to set several watchpoints on the same variable, each one watching a different value being written.)