From: Edward Peschko <edwardp@excitehome.net>
To: gdb@sourceware.cygnus.com
Subject: using perl in gdbinit
Date: Tue, 27 Feb 2001 16:10:00 -0000 [thread overview]
Message-ID: <20010227160952.A25814@excitehome.net> (raw)
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
next reply other threads:[~2001-02-27 16:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-27 16:10 Edward Peschko [this message]
[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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010227160952.A25814@excitehome.net \
--to=edwardp@excitehome.net \
--cc=gdb@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox