Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.140.2.50 -r1.140.2.51 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 27 Sep 2016 07:57:48 -0000 1.140.2.50 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 30 Sep 2016 11:00:38 -0000 1.140.2.51 @@ -2776,23 +2776,42 @@ ad_proc -public ad_get_tcl_call_stack { {level -2} } { - Returns a stack trace from where the caller was called. - See also ad_print_stack_trace which generates a more readable - stack trace at the expense of truncating args. + + Returns a stack trace from where the caller was called. See also + ad_print_stack_trace which generates a more readable stack trace + at the expense of truncating args. @param level The level to start from, relative to this - proc. Defaults to -2, meaning the proc that called this - proc's caller. + proc. Defaults to -2, meaning the proc that called this proc's + caller. Per default, don't show "ad_log", when this calls + ad_get_tcl_call_stack. - @author Lars Pind (lars@pinds.com) @see ad_print_stack_trace } { set stack "" + # + # keep the previous state of ::errorInfo + # + set errorInfo $::errorInfo + for { set x [expr {[info level] + $level}] } { $x > 0 } { incr x -1 } { set info [info level $x] regsub -all \n $info {\\n} info + # + # In case, we have an nsf frame, add information about the + # current object and the current class to the debug output. + # + if {![catch {uplevel #$x ::nsf::current} obj] + && ![catch {uplevel #$x [list ::nsf::current class]} class] + } { + set objInfo [list $obj $class] + set info "{$objInfo} $info" + } + # + # Don't produce too long lines + # if {[string length $info]>200} { set arglist "" foreach arg $info { @@ -2803,6 +2822,10 @@ } append stack " called from $info\n" } + # + # restore previous state of ::errorInfo + # + set ::errorInfo $errorInfo return $stack }