This is the mail archive of the gdb@sources.redhat.com 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: wishlist for gdb ....


Vardhan,

>  
>        Here are some magic possible, by ksh integration , 
>        i would like to know how to achieve similar things in 
>        gdb. 
>  
>     1. (dbx) $(funcs .*foo.*bar.* | sed 's/^/stop in/') 
>        this will set break points in all  
>        functions matching .*foo.*bar !!! 
>        (okay not exactly this, but something similar (-; ) 

The gdb command shell is not a real command interpreter, so you can't do neato programming stuff like this.  However, you can achieve this particular task using the "rbreak" command, which takes as its argument a regular expression, and sets a breakpoint on all the functions that match that regular expression.  In this particular case, rbreak is neater that what is given above, but clearly the programmability is more powerful in the long run.

Another option is to run Insight, which contains a full Tcl interpreter, including a bunch of commands wired into the guts of gdb for accessing variables, registers, etc, and an out to the gdb command set which returns the output in the result of the Tcl command so that you can capture and act on it further.  This is actually a pretty powerful environment (though somewhat poorly documented - sigh...).

In the long run, it would be nice to split the Tcl-only part of insight out from the Tk parts, so you could run Tcl as the command interpreter for gdb.  Someday, I will find the time to do this, but I haven't yet...

>  
>    2.  how to grep help's output ?? 
>        help show | grep arg ????? 
>        or even setenv PAGER=xless displays help in seperate 
>        xless window. 
>  

In this case do something like:

(gdb) tk exec grep arg [gdb_cmd {help show}]  

plus or minus a little tweaking will do what you want...  You could also write the search as a Tcl proc, and run that.  The only bogosity about the console window is that its line wrapping follows the gdb command language rules, not the Tcl ones, so any complicated command has to be put into a file, and sourced, as in:

(gdb) tk source defines_search_proc.tcl
(gdb) tk search_proc arg [gdb_cmd "help show"]

or whatever...

Hope this helps,

Jim

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