* 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
* Re: using perl in gdbinit
[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 15:08 ` Russ Allbery
1 sibling, 1 reply; 6+ messages in thread
From: Edward Peschko @ 2001-02-28 14:21 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb
>
> init_perl ()
> {
> g_interp = Perl_New_Interpreter ();
> }
>
> You should be able to do what you want (albeit in a hacky kind of way).
yeah, you could do this... and it might be a lot less hacky than anticipated,
if the perl module Inline could be used.
> For insight, we added a tcl interpreter and bound tcl's command parser to
> the gdb command "tk". We also have a tcl command, "gdb_cmd", which can be
> used to execute gdb commands in the tcl interpreter.
I didn't see it inside gdb-5.0... is it integrated with the standard
distribution or an add on?
> I could do things like what you want above (although I never have):
> (gdb) tk set help [gdb_cmd help]; puts stdout $help
> (gdb) tk set functions [gdb_cmd "info func main"]; puts stdout $functions
>
> Of course, you are still leaving yourself at the mercy of gdb's human
> readable output, so you'll need to parse gdb's output to do some things
> well.
hmm. that's what made me think of perl in the first place... one question
though, how does the tk interface deal with the 'more'-like behaviour of gdb
(ie: returns at the end of every page, etc.)
Ed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using perl in gdbinit
2001-02-28 14:21 ` Edward Peschko
@ 2001-02-28 14:33 ` Keith Seitz
2001-02-28 14:49 ` Edward Peschko
0 siblings, 1 reply; 6+ messages in thread
From: Keith Seitz @ 2001-02-28 14:33 UTC (permalink / raw)
To: Edward Peschko; +Cc: gdb
On Wed, 28 Feb 2001, Edward Peschko wrote:
> I didn't see [Insight] inside gdb-5.0... is it integrated with the standard
> distribution or an add on?
If you normally download snapshots, you'll need to grab the "insight"
one. It's huge, unfortunately, because it still requires its own versions
of tcl, tk, incrTcl, tix.
If you do an anonymous cvs checkout from sources, you'll want the insight
module. You can add this right on top of any existing gdb checkout.
> > Of course, you are still leaving yourself at the mercy of gdb's human
> > readable output, so you'll need to parse gdb's output to do some things
> > well.
>
> hmm. that's what made me think of perl in the first place... one question
> though, how does the tk interface deal with the 'more'-like behaviour of gdb
> (ie: returns at the end of every page, etc.)
We turn the paging off entirely ("set height 0"). Fortunately, no one has
tried to turn it back on using the gui! :-)
Keith
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using perl in gdbinit
2001-02-28 14:33 ` Keith Seitz
@ 2001-02-28 14:49 ` Edward Peschko
2001-02-28 15:03 ` Keith Seitz
0 siblings, 1 reply; 6+ messages in thread
From: Edward Peschko @ 2001-02-28 14:49 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb
On Wed, Feb 28, 2001 at 02:29:28PM -0800, Keith Seitz wrote:
> On Wed, 28 Feb 2001, Edward Peschko wrote:
>
> > I didn't see [Insight] inside gdb-5.0... is it integrated with the standard
> > distribution or an add on?
>
> If you normally download snapshots, you'll need to grab the "insight"
> one. It's huge, unfortunately, because it still requires its own versions
> of tcl, tk, incrTcl, tix.
hm. I guess, why is it not integrated into 'configure'? ie - why can't you
say
configure --enable-tcl
and download the tcl package separately? Personally I don't want to have a gui
on top of gdb (for that I use ddd), but I *would* want the extra syntax power
that tcl embedded into gdb would give me.
Ed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using perl in gdbinit
2001-02-28 14:49 ` Edward Peschko
@ 2001-02-28 15:03 ` Keith Seitz
0 siblings, 0 replies; 6+ messages in thread
From: Keith Seitz @ 2001-02-28 15:03 UTC (permalink / raw)
To: Edward Peschko; +Cc: gdb
On Wed, 28 Feb 2001, Edward Peschko wrote:
> On Wed, Feb 28, 2001 at 02:29:28PM -0800, Keith Seitz wrote:
> > On Wed, 28 Feb 2001, Edward Peschko wrote:
> >
> > If you normally download snapshots, you'll need to grab the "insight"
> > one. It's huge, unfortunately, because it still requires its own versions
> > of tcl, tk, incrTcl, tix.
>
> hm. I guess, why is it not integrated into 'configure'? ie - why can't you
> say
>
> configure --enable-tcl
>
> and download the tcl package separately? Personally I don't want to have a gui
> on top of gdb (for that I use ddd), but I *would* want the extra syntax power
> that tcl embedded into gdb would give me.
Sorry, this is only offered when Insight is around. You could probaby
hack up your own version of gdb for use with ddd which adds your perl
interpreter.
Keith
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using perl in gdbinit
[not found] ` <Pine.SOL.3.91.1010228073240.19631D-100000@ryobi.cygnus.com>
2001-02-28 14:21 ` Edward Peschko
@ 2001-02-28 15:08 ` Russ Allbery
1 sibling, 0 replies; 6+ messages in thread
From: Russ Allbery @ 2001-02-28 15:08 UTC (permalink / raw)
To: gdb
Keith Seitz <keiths@cygnus.com> writes:
> I would guess that you should be able to add a perl interpreter to
> gdb. I don't know a whole lot about how perl was written, but if there
> is a way to create your own perl interpreter like this:
> init_perl ()
> {
> g_interp = Perl_New_Interpreter ();
> }
> You should be able to do what you want (albeit in a hacky kind of way).
There is. See man perlembed.
--
Russ Allbery (rra@stanford.edu) < http://www.eyrie.org/~eagle/ >
^ 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