This is the mail archive of the 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]

Re: using perl in gdbinit

On Tue, 27 Feb 2001, Edward Peschko wrote:

> 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`;


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).

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 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 


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