Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCL script debugging [closed]

Tags:

debugging

tcl

How to debug TCL scripts? Is there any tool available for debugging?

like image 245
galvin Verghese Avatar asked Dec 12 '22 14:12

galvin Verghese


2 Answers

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...

like image 110
Donal Fellows Avatar answered Dec 19 '22 02:12

Donal Fellows


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

like image 34
jk. Avatar answered Dec 19 '22 04:12

jk.