Subject: Re: Stack info without calling error - DN [1]


dgp@clover.cam.nist.gov (Don Porter) - 19 Oct 1999 - comp.lang.tcl

 Andy Hunt  <andy@ffaltd.demon.co.uk> wrote:
 > Subject line says it all, is there some way of getting the stack trace
 > without calling the error function?

 [info level] is your friend:

 proc StackTrace {} {
     set history ""
     for {set n [expr {[info level]-1}]} {$n>0} {incr n -1} {
         append history "LEVEL $n: [info level $n]\n\n"
     }
     return $history
 }

 --
 | Don Porter, D.Sc.   Mathematical and Computational Sciences Division |
 | donald.porter@nist.gov             Information Technology Laboratory |
 | http://math.nist.gov/mcsd/Staff/DPorter/                        NIST |
 |______________________________________________________________________|

Last modified
1999-11-04

(195.108.246.50)

Note: you are looking at
the snapshot of an old wiki
- much of this information
is likely to be very outdated