Skip to content

Instantly share code, notes, and snippets.

@dscho
Created August 10, 2009 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dscho/165418 to your computer and use it in GitHub Desktop.
Save dscho/165418 to your computer and use it in GitHub Desktop.
set debugfd [open "debug.txt" w]
rename proc _proc
_proc proc {name arglist body} {
uplevel 1 [list _proc $name $arglist $body]
uplevel 1 [list trace add execution $name enterstep [list ::proc_start $name]]
}
_proc proc_start {name command op} {
global debugfd
puts $debugfd "$name >> $command"
}
rename set _set
proc set {var args} {
global debugfd
puts $debugfd [list set $var $args]
uplevel _set $var $args
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment