Skip to content
Tcl Source Code History Of Ticket 3439728
Login

History Of Ticket 3439728

Artifacts Associated With Ticket 3439728

  1. Ticket change [45e114d2ee] (rid 99417) by ladayaroslav on 2011-11-18 05:16:19:

    1. assignee initialized to: "dgp"
    2. cmimetype initialized to: "text/plain"
    3. 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 
      
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "ladayaroslav"
    10. subsystem initialized to: "46. Traces"
    11. title initialized to:
      Leave execution trace created in the same proc doesn't fire
      
    12. type initialized to: "Bug"
  2. Ticket change [44bb84d330] (rid 116753) by dgp on 2011-12-01 23:15:19:

    1. assignee changed to: "msofer"
    2. closedate changed to: "2011-12-01T16:15:19"
    3. closer changed to: "dgp"
    4. foundin changed to: "obsolete: 8.5.10"
    5. 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)
      
      
      
    6. login: "dgp"
    7. mimetype: "text/plain"
    8. resolution changed to: "Invalid"
    9. status changed to: "Pending"
    10. username: "dgp"
  3. Ticket change [71d85bb321] (rid 100749) by ladayaroslav on 2011-12-02 02:43:16:

    1. icomment:
      Ok, but if it's so, then why uncommenting a line:
      'trace add execution test leave GTrace'
      makes  LTrace active?
      
      
    2. login: "ladayaroslav"
    3. mimetype: "text/plain"
    4. username: "ladayaroslav"
  4. Ticket change [cdc43d5a8f] (rid 95947) by msofer on 2011-12-02 05:17:00:

    1. 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?
      
      
    2. login: "msofer"
    3. mimetype: "text/plain"
    4. username: "msofer"
  5. Ticket change [38f6a2b0a2] (rid 135555) by dkf on 2013-11-12 12:33:43:

    1. assignee changed to: "aku"
    2. closedate changed to: "2456609.02341696"
    3. closer changed to: "dkf"
    4. 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
      
    5. login: "dkf"
    6. mimetype: "text/plain"
    7. severity changed to: "Minor"
    8. status changed to: "Closed"