From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10834 invoked by alias); 30 Nov 2007 21:16:06 -0000 Received: (qmail 10826 invoked by uid 22791); 30 Nov 2007 21:16:06 -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; Fri, 30 Nov 2007 21:15:59 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-220-201.inter.net.il [83.130.220.201]) by nitzan.inter.net.il (MOS 3.7.3a-GA) with ESMTP id ILJ24245 (AUTH halo1); Fri, 30 Nov 2007 23:13:19 +0200 (IST) Date: Fri, 30 Nov 2007 21:16:00 -0000 Message-Id: From: Eli Zaretskii To: Vladimir Prus CC: gdb@sources.redhat.com In-reply-to: <200711301925.20196.vladimir@codesourcery.com> (message from Vladimir Prus on Fri, 30 Nov 2007 19:25:19 +0300) Subject: Re: Watchpoints with condition Reply-to: Eli Zaretskii References: <200711301925.20196.vladimir@codesourcery.com> 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-11/txt/msg00301.txt.bz2 > From: Vladimir Prus > Date: Fri, 30 Nov 2007 19:25:19 +0300 > > > GDB presently allow a watchpoint to have a condition, and I wonder > what are the use-cases for that. > > If anybody has used watchpoint in condition in practice when debugging > real problem (as opposed to just playing with gdb, or making up > possible uses), can he share why it was needed? I use it quite a lot. The simplest use case is like this: (gdb) watch foo if foo == 1 This stops at the watchpoint only if the value written to the variable is 1. Imagine that you need to find who writes a specific value into a variable that is otherwise written into a lot by legitimate code.