INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Sample call trace procedure

Sample call trace procedure

(OP)
Since I drop in here now and again to ask questions - thought I'd attempt to return some effort.  The following procedure is something I put together a long time ago but has come in fairly handy while debugging larger scripts.  If anyone has upgrade suggestions - great. If anyone can use this - you are welcome to it:

CODE

# If you just want to look at yourself, call w/ value
#   nesting_levels_to_trace_back = 0
# You'll at least see what was passed to you.
proc call_trace {{nesting_levels_to_trace_back 999}} {
   puts "Call Trace: {call lvl} -> proc args_passed_to_proc"
   set call_trace_nesting_level [info level]
   set calling_nest_level [expr $call_trace_nesting_level - 1]
   if {! [regexp -- {^\s*\d+\s*$} $nesting_levels_to_trace_back]} {
      set nesting_levels_to_trace_back 0
   }

   set level_to_trace_to \
         [expr $calling_nest_level - $nesting_levels_to_trace_back]
   if {$level_to_trace_to < 1} {set level_to_trace_to 1}

   for {set i $calling_nest_level} {$i >= $level_to_trace_to} {incr i -1} {
      set outline [format "%3s --> %s" $i [info level $i]]
      puts $outline
   }
   return {}
};# END call_trace
I know some of the variable names are a little long.  I'd just recently changed them to try and make the code a little more self documenting.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close