Overview
| Artifact ID: | 6ec8c597bd4d5c2b54e4ec5f4e1896d0909c2020530a924e135f1da2f152865b |
|---|---|
| Ticket: | 3f90d66af9c432479bcdbae5fd57c075dd0a468e
Inconsistent behaviour of trace add execute leave on a command already on the stack |
| User & Date: | cyan on 2023-05-04 12:29:21 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-plain"
- comment changed 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) - foundin changed to: "8.7a6"
- is_private changed to: "0"
- login: "cyan"
- priority changed to: "5 Medium"
- private_contact changed to: "54152f94cb1628c0c148b4b5708ace53216227b0"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "cyan"
- subsystem changed to: "46. Traces"
- title changed to:
Inconsistent behaviour of trace add execute leave on a command already on the stack
- type changed to: "Bug"