Artifacts Associated With Ticket 3439728
Ticket change [45e114d2ee] (rid 99417) by ladayaroslav on 2011-11-18 05:16:19:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Script to reproduce: ------------- proc LTrace {args} { puts "LTrace: $args" #Hardcoded: trace remove execution test leave LTrace } proc GTrace {args} {puts "This is global trace: $args"} proc localproc {pname arglist body} { set caller [lindex [info level 1] 0] trace add execution $caller leave LTrace puts "Active traces on $caller: [trace info execution $caller]" proc $pname $arglist "uplevel 1 [list $body]" return } proc test {a b} { localproc lproc {} {puts "a=$a, b=$b"} lproc set a "A" ; set b "B" lproc } #trace add execution test leave GTrace test a 4 puts "---------" test a 5 ------------------ In tcl 8.4.19 it gives: Active traces on test: {leave LTrace} a=a, b=4 a=A, b=B LTrace: {test a 4} 0 {} leave --------- Active traces on test: {leave LTrace} a=a, b=5 a=A, b=B LTrace: {test a 5} 0 {} leave But in tcl 8.6b2 and 8.5.10: Active traces on test: {leave LTrace} a=a, b=4 a=A, b=B --------- Active traces on test: {leave LTrace} {leave LTrace} a=a, b=5 a=A, b=B LTrace: {test a 5} 0 {} leave ----- So, LTrace isn't called first time. Also, if I uncomment the line "#trace add execution test leave GTrace", then in all tcl versions result becomes: --- Active traces on test: {leave LTrace} {leave GTrace} a=a, b=4 a=A, b=B This is global trace: {test a 4} 0 {} leave LTrace: {test a 4} 0 {} leave --------- Active traces on test: {leave LTrace} {leave GTrace} a=a, b=5 a=A, b=B This is global trace: {test a 5} 0 {} leave LTrace: {test a 5} 0 {} leave - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "ladayaroslav"
- subsystem initialized to: "46. Traces"
- title initialized to:
Leave execution trace created in the same proc doesn't fire
- type initialized to: "Bug"
Ticket change [44bb84d330] (rid 116753) by dgp on 2011-12-01 23:15:19:
- assignee changed to: "msofer"
- closedate changed to: "2011-12-01T16:15:19"
- closer changed to: "dgp"
- foundin changed to: "obsolete: 8.5.10"
- icomment:
Isn't this covered in the changes file? 2007-06-21 (feature change)[1740962] leave traces created during execution of traced command do not fire (sofer)
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "dgp"
Ticket change [71d85bb321] (rid 100749) by ladayaroslav on 2011-12-02 02:43:16:
- icomment:
Ok, but if it's so, then why uncommenting a line: 'trace add execution test leave GTrace' makes LTrace active?
- login: "ladayaroslav"
- mimetype: "text/plain"
- username: "ladayaroslav"
- icomment:
Ticket change [cdc43d5a8f] (rid 95947) by msofer on 2011-12-02 05:17:00:
- icomment:
The real issue is: when a command call occurs, are there any execution traces active in the interpreter or for that specific command? 1. if not, then *that* command call will ignore leave traces until it returns 2. if yes, leave traces will be called - whatever they are when the command is done. That is, a *change* during execution will be taken into account, but creation of traces on an untraced-at-invocation command will not. Even more confusing: if instead of uncommenting that line you replace it with trace add execution test enter GTrace then ... the leave trace fires too! The important thing is: was the command traced on invocation or not? The docs are possibly unclear about this (granted, somewhat confusing) behaviour. Suggestions? - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [38f6a2b0a2] (rid 135555) by dkf on 2013-11-12 12:33:43:
- assignee changed to: "aku"
- closedate changed to: "2456609.02341696"
- closer changed to: "dkf"
- comment changed to:
Script to reproduce: ------------- proc LTrace {args} { puts "LTrace: $args" #Hardcoded: trace remove execution test leave LTrace } proc GTrace {args} {puts "This is global trace: $args"} proc localproc {pname arglist body} { set caller [lindex [info level 1] 0] trace add execution $caller leave LTrace puts "Active traces on $caller: [trace info execution $caller]" proc $pname $arglist "uplevel 1 [list $body]" return } proc test {a b} { localproc lproc {} {puts "a=$a, b=$b"} lproc set a "A" ; set b "B" lproc } #trace add execution test leave GTrace test a 4 puts "---------" test a 5 ------------------ In tcl 8.4.19 it gives: Active traces on test: {leave LTrace} a=a, b=4 a=A, b=B LTrace: {test a 4} 0 {} leave --------- Active traces on test: {leave LTrace} a=a, b=5 a=A, b=B LTrace: {test a 5} 0 {} leave But in tcl 8.6b2 and 8.5.10: Active traces on test: {leave LTrace} a=a, b=4 a=A, b=B --------- Active traces on test: {leave LTrace} {leave LTrace} a=a, b=5 a=A, b=B LTrace: {test a 5} 0 {} leave ----- So, LTrace isn't called first time. Also, if I uncomment the line "#trace add execution test leave GTrace", then in all tcl versions result becomes: --- Active traces on test: {leave LTrace} {leave GTrace} a=a, b=4 a=A, b=B This is global trace: {test a 4} 0 {} leave LTrace: {test a 4} 0 {} leave --------- Active traces on test: {leave LTrace} {leave GTrace} a=a, b=5 a=A, b=B This is global trace: {test a 5} 0 {} leave LTrace: {test a 5} 0 {} leave - login: "dkf"
- mimetype: "text/plain"
- severity changed to: "Minor"
- status changed to: "Closed"