From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16583 invoked by alias); 4 Mar 2010 02:05:26 -0000 Received: (qmail 16379 invoked by uid 22791); 4 Mar 2010 02:05:24 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Mar 2010 02:05:21 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 7274FB012; Wed, 3 Mar 2010 18:05:19 -0800 (PST) Received: from [10.20.125.19] (unknown [10.20.125.19]) by jupiter.vmware.com (Postfix) with ESMTP id CDC19DC3D7; Wed, 3 Mar 2010 18:04:38 -0800 (PST) Message-ID: <4B8F155E.8050209@vmware.com> Date: Thu, 04 Mar 2010 02:05:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: Pedro Alves CC: "gdb-patches@sourceware.org" Subject: Re: Watching expressions that don't involve memory (e.g., watch $regfoo) References: <201003040156.44957.pedro@codesourcery.com> In-Reply-To: <201003040156.44957.pedro@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00144.txt.bz2 Pedro Alves wrote: > Anyone else things this is useful? Here's a 5 minute hack at it. > > It allows for e.g.: > > (top-gdb) watch $rax > Watchpoint 4: $rax > (top-gdb) c > Continuing. > Watchpoint 4: $rax > > Old value = 11802104 > New value = 140737488347216 > 0x0000000000456647 in main (argc=1, argv=0x7fffffffe158) at ../../src/gdb/gdb.c:28 > 28 memset (&args, 0, sizeof args); > (top-gdb) > > Current GDB will successfuly create the watchpoint in the > breakpoint list, but it never triggers, because since the > watchpoint isn't watching any memory, it ends up with > no bp_location associated. > > > For extra fun, even watching $_siginfo works. I think watching registers, or expressions involving registers (such as $sp > 0x10000000) could be incredibly useful. Expressions on a varobj sound useful to watch too. One question; what will happen if I watch a constant?