Skip to content
Tcl Source Code View Ticket
Login

View Ticket

trace leavestep fires too early

Closed / Fixed655645ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2002-12-18 09:54:30
[email protected]

Command execution traces for "leavestep" fire even 
before the respective "enterstep", with null string result, 
and then again (correctly) after the command has been 
executed. This happens for all but the first command in 
a proc.

Demo script:

proc enterStep {cmd op} {puts "enter $cmd/$op"}
proc leaveStep {cmd code result op} {puts "leave $cmd/
$code/$result/$op"}

proc foo x {
    puts x=$x
    puts [info patchlevel]
    incr x
}
trace add execution foo enterstep enterStep
trace add execution foo leavestep leaveStep
foo 42

produces (8.4.1, W2k, Solaris):

enter puts x=42/enterstep
x=42
leave puts x=42/0//leavestep
leave info patchlevel/0//leavestep
enter info patchlevel/enterstep
leave info patchlevel/0/8.4.1/leavestep
leave puts 8.4.1/0//leavestep
enter puts 8.4.1/enterstep
8.4.1
leave puts 8.4.1/0//leavestep
leave incr x/0//leavestep
enter incr x/enterstep
leave incr x/0/43/leavestep
dkf Ticket [655645ffff]: 1 change [History diff]2002-12-18 20:28:28
dgpplain2002-12-19 04:29:07
Logged In: YES 
user_id=80530

Assigning to Vince in case he has any insight.
vincentdarleyplain2003-01-17 18:26:10
Logged In: YES 
user_id=32170

Ok, I've fixed this, and will check in the solution asap.
Log in (anonymous is fine) to add a comment.