Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* using perl in gdbinit
@ 2001-02-27 16:10 Edward Peschko
       [not found] ` <Pine.SOL.3.91.1010228073240.19631D-100000@ryobi.cygnus.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Edward Peschko @ 2001-02-27 16:10 UTC (permalink / raw)
  To: gdb

hey all -

I'd like to use perl in gdbinit to make gdb commands and bind them to a key. 
So I could say stuff like:

local($/) = undef;
my $functions  = `info functions`;

while ($functions =~ m"File\s*(\S+):\n(.*?)(?=File)"sg)
{
	my ($filename, $functions) = ($1, $2);
	$functionhash{$filename} = _getfilefunctions($functions);
}

foreach $file (keys(%functionhash))
{
	my $filename = $file;
	$filename =~ s".*/(.*?)(?:\..*|$)"$1";

	my $define = "define b$filename\n" . join("\n", 
					map("b $_", @{$functionhash{$file}} )) .
					"end\n";

	`$define`;
}

to define bmod_so to mean 'set breakpoints on all of the functions in mod_so.c',
balloc to mean 'set breakpoints on all of the functions in alloc.c', etc. above,
I'm using `` to communicate with gdb, it could be -just as easily - a 
function call.


So, is there any way people know of doing this automatically? (it doesn't have
to be as fancy, maybe being able to say:

info functions >> f

to pipe the output of info functions into the file f would do it...

Ed


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-02-28 15:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-27 16:10 using perl in gdbinit Edward Peschko
     [not found] ` <Pine.SOL.3.91.1010228073240.19631D-100000@ryobi.cygnus.com>
2001-02-28 14:21   ` Edward Peschko
2001-02-28 14:33     ` Keith Seitz
2001-02-28 14:49       ` Edward Peschko
2001-02-28 15:03         ` Keith Seitz
2001-02-28 15:08   ` Russ Allbery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox