<i>Inconsistent behaviour of trace add execute leave on a command already on the stack</i>.
by
.
D 2023-05-04T12:29:21.976
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-plain
J comment If\sa\sproc\sthat\sis\scurrently\sexecuting\sadds\san\sexecution\sleave\strace\son\sitself,\r\nthe\strace\sonly\sfires\swhen\sthat\scall\sreturns\sif\sthe\sproc\salready\shad\san\s(unrelated)\r\nexecution\strace\sregistered\sfor\sit\swhen\sit\sstarted\sexecuting.\s\sOtherwise\sthe\strace\sfires\r\nonly\son\sthe\snext\scall\sto\sthe\scommand:\r\n\r\nproc\s_finish\s{target\scmd\scode\sresult\sop}\s{\r\n\s\s\s\strace\sremove\sexecution\s$target\sleave\s[list\s::_finish\s$target]\r\n\s\s\s\s#\sfire\sfinish\sbreakpoint\r\n\s\s\s\sputs\s"would\sfire\sfini\sbreak"\r\n}\r\n\r\nproc\sfoo\s{}\s{\r\n\s\s\s\sputs\s"in\sfoo"\r\n\s\s\s\sset\starget\s[namespace\swhich\s-command\s[lindex\s[info\slevel\s0]\s0]]\r\n\s\s\s\strace\sadd\sexecution\s$target\sleave\s[list\s::_finish\s$target]\r\n}\r\n\r\n#\sWorks\sif\sthis\sline\sis\suncommented\r\n#trace\sadd\sexecution\sfoo\senter\s{apply\s{args\s{}}}\r\n\r\nputs\s"first\sfoo:\s[foo]"\r\nputs\s"second\sfoo:\s[foo]"\r\n\r\n\r\n@aspect\son\sthe\sTcl\schat\sfound\sthis:\s"the\sblock\sin\sEvalObjvCore\sthat\ssets\sup\r\nTEOV_RunLeaveTraces\sis\sunder\san\sif\swhose\scondition\sincludes\s(cmdPtr->flags\s&\sCMD_HAS_EXEC_TRACES)"\r\nI\sunderstand\sthat\sthe\sperformance\soverhead\smay\sbe\sprohibitive\sfor\srechecking\seach\stime\sa\r\nproc\sfinishes,\sbut\sI'm\sraising\sthis\sticket\sin\scase\sit\scan\sbe\smade\sfeasible,\sor\sat\sleast\r\nbe\sdocumented\sthat\sregistering\sa\sleave\strace\son\sa\sproc\son\sthe\scall\sstack\sis\sundefined\r\n(depends\son\sother\strace\sstate)
J foundin 8.7a6
J is_private 0
J login cyan
J priority 5\sMedium
J private_contact 54152f94cb1628c0c148b4b5708ace53216227b0
J resolution None
J severity Minor
J status Open
J submitter cyan
J subsystem 46.\sTraces
J title Inconsistent\sbehaviour\sof\strace\sadd\sexecute\sleave\son\sa\scommand\salready\son\sthe\sstack
J type Bug
K 3f90d66af9c432479bcdbae5fd57c075dd0a468e
U cyan
Z a1f364845bef9efab98aff5d7f158af7