Subject: Re: ANNOUNCE: Insight GUI interface for gdb... - DN [1]


James Ingham <jingham@leda.cygnus.com> - 02 Aug 1999 - comp.lang.tcl

 Tom,

 > >>>>> "Andreas" == Andreas Kupries <a.kupries@westend.com> writes:
 >
 > Andreas> Does that mean, that it is possible to execute a tcl
 > Andreas> procedure upon reaching a breakpoint ?
 >
 > No.  Insight is a GUI for gdb, but it doesn't integrate Tcl into the
 > gdb core.
 >
 > Tom

 Well, this is not quite true.  If you run Insight, as opposed to
 command-line GDB, you have a Tcl interpreter available that in fact
 knows quite a bit about GDB's internals, and gets informed about most
 of the interesting things that happen in GDB land.  What Tom is saying
 is that the Tcl interpreter is a) not activated when you do "gdb -nw",
 and is not the interpreter for the gdb Console.  But it is most
 definitely there and useable, if you fire up the GUI.

 Within Insight, there are a couple of ways to get at the Tcl
 interpreter.

 1) If you are in the gdb console, you can use the "tk"
    command, and anything after that is passed to the Tcl interpreter.
    This is only moderately useful, however, for two reasons: a) The code
    executed by the Tk command is not run in the global namespace
    (something I have been meaning to fix for a while, but haven't gotten
    to yet...)  b) The console does GDB style command complete, so you
    have to type everything on one line.

 2) The reason I haven't fixed this yet, is that I just keep a TkCon
 window open - (I usually have one lying around anyway - thanks
 Jeffrey!), and use send to talk to it through TkCon.  This works
 beautifully...

 Back to the original point: it is simple to use the "tk" command in
 in the "commands" for the gdb breakpoint.  This would have exactly
 the effect that you want.  I.e.:

 (gdb) break foo.c:20
 (gdb) commands
 Type commands for when breakpoint 3 is hit, one per line.  End with a line saying just "end".

 >tk set ::blubby 0
 >end

 Then ::blubby will be set when the breakpoint is hit...

 There are a whole bunch of good Tcl commands for grubbing around in
 GDB's internal state, that will help you write useful code in these
 commands.  Look in the file gdbtk-cmds.c.  There is no docs for them
 yet (on my plate, but...), but all the commands are documented in the
 C code with argument list & results.  You can also run any standard
 gdb command using the tcl command "gdb_cmd", and the output of the gdb
 command will be passed to the Tcl interpreter's result.

 Of course, there should be a nicer way to do this than using this
 console trick.  I am going to be mucking with the breakpoint window
 soon, and I will see if I can add this.  However, if someone else
 wants to give it a try before I get to it, I will be happy to get them
 started...

 Jim
 --
 ++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++
 Jim Ingham                                              jingham@cygnus.com
 Cygnus Solutions Inc.

Last modified
1999-09-27

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated