Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-12-13
18:21 • Closed ticket [614282ffff]: improve docs for trace enterstep behavior plus 8... artifact: 86e1e77d0e user: dkf
2007-10-31
23:41 • Ticket [614282ffff]: 1 change artifact: b7b5f126b5 user: dgp
2003-10-08
23:54 • Ticket [614282ffff]: 1 change artifact: 7b26215421 user: dgp
2003-07-18
12:58 • Ticket [614282ffff]: 1 change artifact: 92e7afc9e7 user: dgp
2003-07-17
10:28 • Ticket [614282ffff]: 7 changes artifact: 0cde21d998 user: dgp
04:57 • Ticket [614282ffff]: 4 changes artifact: 2d8d42f98d user: vincentdarley
04:05 • Ticket [614282ffff]: 6 changes artifact: b267fbcc4f user: dgp
04:00 • Ticket [614282ffff]: 4 changes artifact: 196a33420d user: dgp
2003-07-16
19:58 • Ticket [614282ffff]: 1 change artifact: f2adb59fa7 user: dgp
2003-06-26
22:46 • Ticket [614282ffff]: 1 change artifact: c77e14d93f user: dgp
17:30 • Ticket [614282ffff]: 1 change artifact: 6182c7d99f user: dkf
2002-09-25
09:18 • New ticket [614282ffff]. artifact: 7091ead2c6 user: nobody

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.