View · Search · Index
No registered users in community xowiki
in last 10 minutes

Re: [Xotcl] full trace support for XOTcl methods/procs

From: Eckhard Lehmann <eckhardnospam_at_gmx.de>
Date: Wed, 02 Jan 2008 11:51:22 +0100

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