TCL script debugging [closed]
开发者_运维问答 We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionHow 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
The already mentioned list at the tcl'ers wiki is a good resource, and even though the ActiveState TclDevKit debugger is the best available (and also the one used by the Eclipse based Tcl IDE), there are a few other options.
One might be RamDebugger: http://www.compassis.com/ramdebugger/Intro
精彩评论