This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Indirect access to GDB history variables


> Date: Thu, 14 Dec 2006 18:40:50 -0800
> From: Steve Rodrigues <steverod@netapp.com>
> Cc: Steve Rodrigues <steverod@netapp.com>
> 
> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]