From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3219 invoked by alias); 15 Dec 2006 08:43:17 -0000 Received: (qmail 3208 invoked by uid 22791); 15 Dec 2006 08:43:16 -0000 X-Spam-Check-By: sourceware.org Received: from romy.inter.net.il (HELO romy.inter.net.il) (192.114.186.66) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Dec 2006 08:43:11 +0000 Received: from HOME-C4E4A596F7 (IGLD-80-230-33-183.inter.net.il [80.230.33.183]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id GNV75296 (AUTH halo1); Fri, 15 Dec 2006 10:43:05 +0200 (IST) Date: Fri, 15 Dec 2006 08:43:00 -0000 Message-Id: From: Eli Zaretskii To: Steve Rodrigues CC: gdb-patches@sources.redhat.com In-reply-to: <20061215024050.GA8750@linden.netapp.com> (message from Steve Rodrigues on Thu, 14 Dec 2006 18:40:50 -0800) Subject: Re: [patch] Indirect access to GDB history variables Reply-to: Eli Zaretskii References: <20061215024050.GA8750@linden.netapp.com> 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: 2006-12/txt/msg00195.txt.bz2 > Date: Thu, 14 Dec 2006 18:40:50 -0800 > From: Steve Rodrigues > Cc: Steve Rodrigues > > New Feature for GDB: Programmatic access to the value history. > > Problem Description: Our company has a wide variety of GDB scripts used to > analyze problems within core files. Many of these scripts will generate values > that are useful to probe into later; however, the scripts will generate a LOT > of values, or values that aren't in sequential order (you care about, say, > every third value). GDB only lets you reference previous history value either > with absolute numbers ($10, $236) or with reference to the most recently printed value ($$, $$9, etc). It sure would be nice if there was a way to be able to > access the value history by indirecting through a variable. Why can't you put the values you are interested in into a named variable, like $foo, and use that? > Feature: This patch enables users to programmatcially access the value history > through a GDB variable, by overloading the "$$" construct to contain a variable > name. For example, if my script had printed out values $10-$27, but only every > 3rd one was interesting (it was a pointer I wished to examine further), I could > do the following: > > set $i=10 > while ($i < 28) > p *$$i > set $i+= 3 > end > > ... and I'd see values of $10, $13, $16 and so on. This makes it easier to > compose scripts together when debugging. Thanks. If this patch is accepted, I will request you to write a patch for the manual to describe this feature. It should also be mentioned in NEWS.