: <i>Error in an execution trace reports line 1 and loses the traced command's frame in errorInfo</i> plus 7 other changes
by
.
D 2026-11-27T15:26:47.587
J assignee jan.nijtmans
J closer nobody
J comment When\san\sexecution\strace\s(enter\sor\sleave)\sraises\san\serror,\sthe\serrorInfo\shas\sthe\swrong\sline\snumber\sand\sloses\sthe\sframe\sof\sthe\straced\scommand.\sFile\s<tt>x.tcl</tt>:\r\n\r\n<verbatim>\r\nproc\sp\sargs\s{}\r\ntrace\sadd\sexecution\sp\sleave\s{error\sboom;#}\r\n\r\np\r\n</verbatim>\r\n\r\n<nowiki>[catch\s{source\sx.tcl}\sm\so;\sputs\s[dict\sget\s$o\s-errorinfo]]</nowiki>\sin\s8.6.1\sand\slater\s(also\s9.0.5\sand\smain):\r\n\r\n<verbatim>\r\nboom\r\n\s\s\s\swhile\sexecuting\r\n"error\sboom"\r\n\s\s\s\s(leave\strace\son\s"p")\r\n\s\s\s\s(file\s"x.tcl"\sline\s1)\r\n\s\s\s\sinvoked\sfrom\swithin\r\n"source\sx.tcl"\r\n</verbatim>\r\n\r\n8.5.19\ssays\s<tt>(file\s"x.tcl"\sline\s4)</tt>,\swith\s<tt>invoked\sfrom\swithin\s"p"</tt>\sbefore\sit\s(8.6.0\salso\ssays\sline\s4,\sbut\sdrops\sthe\serror\smessage\sof\sthe\strace,\ssee\s[2438181fff]).\sThe\ssame\shappens\swith\s<tt>enter</tt>\straces,\sin\sproc\sbodies\s(<tt>(procedure\s"q"\sline\s1)</tt>)\sand\sin\s<nowiki>[eval]</nowiki>\sbodies.\sVariable\straces\sare\snot\saffected\s(<tt>(write\strace\son\s"v")</tt>,\s<tt>invoked\sfrom\swithin\s"set\sv\s1"</tt>,\scorrect\sline).\r\n\r\nCause:\sthe\sfix\sfor\s[010f4162ef]\s([f0e808cc64],\s8.6.1)\sappends\s<tt>(enter/leave\strace\son\s"...")</tt>\sin\s<tt>TEOV_RunEnterTraces()</tt>\s/\s<tt>TEOV_RunLeaveTraces()</tt>\sin\s<tt>generic/tclBasic.c</tt>\sand\sthen\ssets\s<tt>ERR_ALREADY_LOGGED</tt>.\sThat\sflag\smakes\sthe\scaller\sskip\s<tt>TclLogCommandInfo()</tt>,\swhich\sis\swhere\sthe\sline\snumber\sof\sthe\sfailing\scommand\sis\scomputed\sand\sthe\s<tt>invoked\sfrom\swithin</tt>\sframe\sis\sadded,\sso\sthe\sline\sstays\s1.\r\n\r\nA\sfix\swould\sneed\sto\skeep\sthat\slogging\sin\sthe\scaller\swhile\sstill\savoiding\sthe\sdoubled\s<tt>-errorstack</tt>\slevel\sfrom\s[010f4162ef].
J icomment Merged\sto\s[f158fb9ffa|trunk]
J login jan.nijtmans
J mimetype text/x-fossil-wiki
J resolution Fixed
J status Pending
K afa8c9f5bbde5127175f4a9f118106aed36f6773
U jan.nijtmans
Z d7dc08f6e32b27d73beded678c53a315