How to debug TCL scripts? Is there any tool available for debugging?
The best debugger I know of for Tcl is part of ActiveState's TclDevKit; it's non-free, but highly recommended. (There's also a free 21-day trial available.)
Other options are available. For one thing, Tcl's built-in trace
command makes it pretty simple to add in your own breakpoints, watchpoints, do single-step tracing, etc. Yet there's something of a lack of proper free integrated tools (precisely because as a community we get on really well with the ActiveState crew). Still, you might find the next code sample useful:
Trace all command calls:
# overwrite at each invocation of this script; pick somewhere else if you prefer
set _Trace_fd [open "/tmp/tcltrace.tmp" w]
fconfigure $_Trace_fd -buffering line
rename proc _proc
_proc proc {name arglist body} {
uplevel [list _proc $name $arglist $body]
uplevel trace add execution $name enterstep {::apply {{name cmd op} {
puts $::_Trace_fd "$name >> $cmd"
}}}
}
Note, this produces rather a lot of output with typical code...
TCL is a good tool for debugging TCL. have a look at the trace command. Also info and winfo can be useful. if you want something which wraps these up into a more traditional debugger there is a list at http://wiki.tcl.tk/473
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With