Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tgdb: a debugger for Tcl

5 views
Skip to first unread message

Peter MacDonald

unread,
Mar 11, 2002, 11:48:12 AM3/11/02
to
tgdb is a debugger I'm developing based on the Tcl line number
patch described below. Here is the README from the distro.

Peter

*************** README *************************************

Copyright 2002, Peter MacDonald http://browsex.com

tgdb: alpha version 0.1

"tgdb" is a simple/small debugger for Tcl that emulates gdb using the
Tcl line-number patch (TIP #86 http://purl.org/tcl/tip/86).
"tgdb" and the patch are available from:

http://dev.browsex.com/tgdb.tar.gz
http:/dev.browsex.com/cline.diff.gz

"tgdb" can be used standalone or in conjunction with "tdb"
(see http://browsex.com/TDB.html).
Using tdb and tgdb with the debugging patch, I've been able to

- be single stepping through a C program
- have it eval a Tcl script and single step through that script
- have Tcl call a C extension and be singling step through C again.

ie. a single debugger GUI able to debug both C and Tcl simultaneously.
This works because tgdb outputs the same format as gdb.

tgdb is as yet alpha software, so don't expect it to be useful.
But already it supports breakpoints on lines,
single-stepping and displaying/locating
source and even works as a slave under tdb, a debugger GUI written in Tk

tgdb emulates some of the basic commands of gdb (s, n, c, f, bt, break and
info locals). This newest version also supports watchpoints and display
variables. The "up" and "down" commands are not quite there yet.
Nor are "load" and "run".

The tgdb strategy is to determine the line number by searching from the
reported line number forward for the currently executing command.
Although not foolproof, in practice this is almost always accurate.
The search is done:

- When in a function, in the procedure body

- When at global level, in the file source starting from reported line.


BUILDING

The following steps will build the line-number patched Tcl
and tgdb using it.

tar -xzpvf tcl8.4a4-src.tar.gz
patch -p0 < tclline.diff
tar -xzpvf tgdb.tar.gz
cd tcl8.4a4/unix
./configure --prefix=../../
make install
cd ../../tgdb
make

Here is an example demonstrating single stepping through
both C and Tcl with tdb.

./tdb tgdb -- -f test4.tcl

(gdb) c # In C debugger, Continue
(tdb) s # In Tcl, single step "load" extension
(tdb) ^C # Break out to gdb
(gdb) b ctestcmd # Set breakpoint on extension call
(gdb) c # Continue gdb, returning to Tcl.
(tdb) s # Single step in Tcl for extension call.
(gdb) # You should now have broken in ctestcmd().

TODO: A description of the mechanics of how this works.


Mar 11, 2002

Bruce Stephens

unread,
Mar 27, 2002, 5:56:38 AM3/27/02
to
pe...@browsex.com (Peter MacDonald) writes:

[...]

> tgdb is as yet alpha software, so don't expect it to be useful.
> But already it supports breakpoints on lines,
> single-stepping and displaying/locating
> source and even works as a slave under tdb, a debugger GUI written in Tk

Cool! I just got around to trying it yesterday, and it works in
Emacs's gdb mode, too.

[...]

0 new messages