Skip to content
Tcl Source Code History Of Ticket 3f90d66af9c43247
Login

History Of Ticket 3f90d66af9c43247

Artifacts Associated With Ticket 3f90d66af9c43247

  1. Ticket change [6ec8c597bd] (rid 214541) by cyan on 2023-05-04 12:29:21:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      If a proc that is currently executing adds an execution leave trace on itself,
      the trace only fires when that call returns if the proc already had an (unrelated)
      execution trace registered for it when it started executing.  Otherwise the trace fires
      only on the next call to the command:
      
      proc _finish {target cmd code result op} {
          trace remove execution $target leave [list ::_finish $target]
          # fire finish breakpoint
          puts "would fire fini break"
      }
      
      proc foo {} {
          puts "in foo"
          set target [namespace which -command [lindex [info level 0] 0]]
          trace add execution $target leave [list ::_finish $target]
      }
      
      # Works if this line is uncommented
      #trace add execution foo enter {apply {args {}}}
      
      puts "first foo: [foo]"
      puts "second foo: [foo]"
      
      
      @aspect on the Tcl chat found this: "the block in EvalObjvCore that sets up
      TEOV_RunLeaveTraces is under an if whose condition includes (cmdPtr->flags & CMD_HAS_EXEC_TRACES)"
      I understand that the performance overhead may be prohibitive for rechecking each time a
      proc finishes, but I'm raising this ticket in case it can be made feasible, or at least
      be documented that registering a leave trace on a proc on the call stack is undefined
      (depends on other trace state)
      
    5. foundin initialized to: "8.7a6"
    6. is_private initialized to: "0"
    7. login: "cyan"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "54152f94cb1628c0c148b4b5708ace53216227b0"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "cyan"
    14. subsystem initialized to: "46. Traces"
    15. title initialized to:
      Inconsistent behaviour of trace add execute leave on a command already on the stack
      
    16. type initialized to: "Bug"