I use the trace syntax available in the TIP( TCL improvement Proposal )86.
A new execution subcommand to the trace command.
trace execution target ?level?
This arranges for an execution trace to be setup for commands at nesting level or above, thereby providing a simple Tcl interface for tracing commands to say, implement a debugger. With no arguments, the current target is returned. If target is the empty string, the execution trace is removed. The target argument is assumed to be a command string to be executed. When level is not specified, it defaults to 0, meaning trace all commands. For each traced command, the following data will be produced:
The line number the instruction begins on.
The fully normalized file name.
The nesting level of the command.
The stack call level as per info level.
The current fully qualified namespace/function.
The fully qualified command name of the command to be invoked.
The command line to be executed including arguments.
Integer bit flags, currently bit 1 is set for breakpoint.
The target is presumed to be a valid Tcl command onto which is appended the above arguments before evaluation. Any return from the command other than a normal return results in the command not being executed. As with all traces, execution tracing is disabled within a trace handler.