From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4879 invoked by alias); 4 Mar 2010 07:40:00 -0000 Received: (qmail 4864 invoked by uid 22791); 4 Mar 2010 07:39:59 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Mar 2010 07:39:55 +0000 Received: from eliz by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nn5ez-0006BG-5a; Thu, 04 Mar 2010 02:39:53 -0500 From: Eli Zaretskii To: Joel Brobecker CC: pedro@codesourcery.com, gdb-patches@sourceware.org In-reply-to: <20100304053017.GH2832@adacore.com> (message from Joel Brobecker on Thu, 4 Mar 2010 09:30:17 +0400) Subject: Re: Watching expressions that don't involve memory (e.g., watch $regfoo) Reply-to: Eli Zaretskii References: <201003040156.44957.pedro@codesourcery.com> <20100304053017.GH2832@adacore.com> Message-Id: Date: Thu, 04 Mar 2010 07:40:00 -0000 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: 2010-03/txt/msg00162.txt.bz2 > Date: Thu, 4 Mar 2010 09:30:17 +0400 > From: Joel Brobecker > Cc: gdb-patches@sourceware.org > > > Anyone else things this is useful? Here's a 5 minute hack at it. > > +* Watchpoints on expressions not involving memory > > + > > + GDB now supports watching expressions that don't involve memory. > > + This allows, for example, watching for register changes. > > + E.g. "watch $pc" will do the right thing. > > I think that this might be very useful, indeed. For instance, if > a variable is stored in a register instead of memory. What would be _really_ nice is if GDB would automatically put a watchpoint on the register that hold the variable, when the debug info tells that. In optimized programs, watching the memory alone will frequently miss value changes.