[Xotcl] full trace support for XOTcl methods/procs

Eckhard Lehmann eckhardnospam at gmx.de
Wed Jan 2 11:51:22 CET 2008


Hello Gustaf,
> first, a happy new year to everybody!
Ihnen auch ein frohes neues Jahr :)!

> Here is a small example for tracing the calls within a method ("doit"),
> which is somewhat similar to enterstep. Given is the following sample 
> script:
[...]

The example is very illustrative, thanks for that. However, it seems 
that only calls to object methods are traced. In practical code I have 
ordinary Tcl statements as well, e.g. the instproc "doit" could look like:

B instproc doit {args} {
 my set x 1
 my foo
 set l {a b c d}
 for {set i 0} {$i < [llength $l]} {incr i} {
   puts $i
   my_old_tcl_proc $i [lindex $l $i]
 }
 # lots of other stuff...
 next
 my set y 4
}

When I run that, only the calls to [my set x 1], [my foo] etc. are 
intercepted, but not [set l {a b c d}] and [for].
> Allthough all xotcl methods are commands, with the current framework,
> the tcl command traces are not called autmatically, since the basic
> invocation mechanisms (with inheritance, filters, mixins) are handled
> by xotcl. Without looking into the details, i think it should be possible
> with moderate effort to incorporate tcl command traces in xotcl. But
> one has to convince the developers, that adding yet another interception
> mechanism to xotcl adds more benefits than causing confusion.
I see that there is no need for another interception technique, but it 
would be really helpful to have the current filter techiques also 
applied to ordinary Tcl code inside methods.

To be more precise, I am looking for a way to debug larger XOTcl 
programs. http://wiki.tcl.tk/6007 describes a very nice and small 
debugger that uses [trace exec] and can be applied to ordinary Tcl 
proc's. I would like to extend that code, e.g. create an XOTcl class 
"Debugger", that provides methods for step, breakpoint etc. It should be 
possible to mixin this to any other XOTcl object for debugging purposes.


Thanks so far,
Eckhard



More information about the Xotcl mailing list