improve docs for trace enterstep behavior
Closed / Fixed614282ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 19 years ago
Descriptionplain2002-09-25 09:18:43
trace enterstep does not only fire on every command in
a procedure but also in all called procedures if they
have also enterstep set.
Consider
proc x {} { y }
proc y {} { z }
proc z {} { stuff }
a tace enterstep on x,y and z fires on the commands in
stuff three times, but only if there is really a
enterstep on y and z. Only an enterstep on x does not
fire on y and z body commands.
dkf Ticket [614282ffff]: 1 change
[History diff]2003-06-26 17:30:00
dgp Ticket [614282ffff]: 1 change
[History diff]2003-06-26 22:46:55
dgp Ticket [614282ffff]: 1 change
[History diff]2003-07-16 19:58:48
dgpplain2003-07-17 04:00:49
Logged In: YES
user_id=80530
To clarify the report:
% proc report args {puts [info level 0]}
% proc x {} y
% proc y {} z
% proc z {} stuff
% proc stuff {} {puts stuff}
% foreach cmd {x y z} {
trace add execution $cmd enterstep {report}
}
% x
report y enterstep
report z enterstep
report z enterstep
report stuff enterstep
report stuff enterstep
report stuff enterstep
report {puts stuff} enterstep
report {puts stuff} enterstep
report {puts stuff} enterstep
dgpplain2003-07-17 04:05:08
Logged In: YES user_id=80530 I need a ruling from a TIP 62 Author on whether or not this is the intended behvaior.
vincentdarleyplain2003-07-17 04:57:28
Logged In: YES
user_id=32170
I believe 'enterstep' should fire on *all* commands inside 'x',
at all nested levels, as this indicates:
(bin) 2 % proc report args {puts [info level 0]}
(bin) 3 % proc x {} y
(bin) 4 % proc y {} z
(bin) 5 % proc z {} stuff
(bin) 6 % proc stuff {} { puts stuff }
(bin) 7 % trace add execution x enterstep report
(bin) 8 % x
report y enterstep
report z enterstep
report stuff enterstep
report {puts stuff} enterstep
stuff
(bin) 9 %
When you now add multiple 'enterstep' traces, things get
more complicated, but the behaviour you show looks
reasonable.
This was the design of tip62, so that it allowed, effectively,
arbitrary tracing of execution for profiling or debugging
purposes inside any given procedure.
It seems perhaps you have a different design in mind?
dgpplain2003-07-17 10:28:19
Logged In: YES user_id=80530 It seems the submitter expected something different, and I the docs weren't clear to me. Now that I know this is the intended behavior, I'll look into improving the docs. Suggestions accepted.
dgp Ticket [614282ffff]: 1 change
[History diff]2003-07-18 12:58:44
dgp Ticket [614282ffff]: 1 change
[History diff]2003-10-08 23:54:20
dgp Ticket [614282ffff]: 1 change
[History diff]2007-10-31 23:41:11
dkfplain2007-12-13 18:21:12
Logged In: YES user_id=79902 Originator: NO Clarified (including adding example)
Log in (anonymous is fine) to add a comment.