Purpose: to discuss the tools and techniques for debugging Tcl/Tk/etc. applications making use of Tcl's introspection capabilities.
- Tools to leverage Tcl's native introspection
- TkInspect (the Tcl Dev Kit has an enhanced version)
- TkCon
- XotclIDE
- TclTalk uses introspection to present all namespaces, variables and procedures of the running interperter.
- info is your friend. escargo is fond of using a proc containing puts [lindex [info level -1] 0 ]
[I'd love to see pointers to tutorials, white papers, etc. on how to make use of tkinspect, tkcon, etc. for debugging Tcl/Tk applications].
So would I :-)
[
PT] 21-Jun-03: I've added a tkinspect tutorial to the
Tkinspect page.
[
tb] 2008-07-30:
Debugging with TclTalkAllthough there is no real debugger in TclTalk, its browser always allows a live view into variables. To halt a script at a certain line, insert the line
vwait ::MySemaphore, or what you like to name the variable. Also you could output a string to the transcript saying, that your program is halted. Then you may inspect your variables of interest (or even change them :) using one browser and another one to toggle your semaphore and continue your script.
When debugging a Tk app, then it might be usefull to do a
wm withdraw .mywindow, to hide your app and not change the state of it by GUI events, which might occur accidently. Use
wm deiconify .mywindow afterwards, to make your application visible again.
Category Debugging