http://purl.org/tcl/home/man/tcl8.4/TclCmd/info.htm ---- What are some common uses of the info command in day to day programming? '''`[info cmdcount]`''': ---- In response to a question about finding a way to tell who called a particular proc, [Bruce Hartweg] wrote on news:comp.lang.tcl (in message 3B157767.A720881E@raytheon.com ): In [https://groups.google.com/d/msg/comp.lang.tcl/uKX9hWPMECc/SwlSBxTdJF4J%|%How can I tell where a proc was called], [comp.lang.tcl], 2001-05-30, in response to a question about finding a way to tell who called a particular proc, [Bruce Hartweg] wrote (modified): # quick tester: proc who_called {} { proc who_called {} { puts "I was called from '[lindex [info level -1] 0]' - but first call was to '[lindex [info level 1] 0]'" } proc a {} who_called proc a {} {who_called} proc b {} {who_called} proc c {} {who_called} proc d {} {a} proc e {n} {$n} # end # end Output: Output: ======none % a I was called from 'a' - but first call was to 'a' % b I was called from 'b' - but first call was to 'b' % c I was called from 'c' - but first call was to 'c' % d I was called from 'a' - but first call was to 'd' % e a I was called from 'a' - but first call was to 'e' % e b I was called from 'b' - but first call was to 'e' % e c I was called from 'c' - but first call was to 'e' % e d I was called from 'a' - but first call was to 'e' ---- And [Will Taylor] writes: I find a backtrace useful -- putting these two stmts in the proc in question: I find a backtrace useful -- putting these two stmts in the proc in question: set backtrace ""; getBackTrace backtrace puts stderr ": `$backtrace'" ====== proc getBackTrace { backTraceRef } { upvar $backTraceRef backTrace set startLevel [expr {[info level] - 2}] set startLevel [expr {[info level] - 2}] for {set level 1} {$level <= $startLevel} {incr level} { append backTrace "[lindex [info level $level] 0] => " } } Note also that the [Bag of algorithms] makes a couple of mentions of backtracing, and even has other uses of [[info ...]]. ---- ====== [Tcl syntax help] - [Arts and crafts of Tcl-Tk programming] - [Category Command]