From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edward Peschko To: gdb@sourceware.cygnus.com Subject: using perl in gdbinit Date: Tue, 27 Feb 2001 16:10:00 -0000 Message-id: <20010227160952.A25814@excitehome.net> X-SW-Source: 2001-02/msg00426.html 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