<i>Error in an execution trace reports line 1 and loses the traced command's frame in errorInfo</i>.
by
.
D 2026-10-17T10:51:12.099
J cmimetype text/x-fossil-wiki
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>:\n\n<verbatim>\nproc\sp\sargs\s{}\ntrace\sadd\sexecution\sp\sleave\s{error\sboom;#}\n\np\n</verbatim>\n\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):\n\n<verbatim>\nboom\n\s\s\s\swhile\sexecuting\n"error\sboom"\n\s\s\s\s(leave\strace\son\s"p")\n\s\s\s\s(file\s"x.tcl"\sline\s1)\n\s\s\s\sinvoked\sfrom\swithin\n"source\sx.tcl"\n</verbatim>\n\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).\n\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.\n\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 foundin 8.6.18,\s9.0.5,\s9.1.0
J login serhiy.storchaka
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J subsystem 46.\sTraces
J title Error\sin\san\sexecution\strace\sreports\sline\s1\sand\sloses\sthe\straced\scommand's\sframe\sin\serrorInfo
J type Bug
K afa8c9f5bbde5127175f4a9f118106aed36f6773
U serhiy.storchaka
Z a670bae91f06d7040c428e65af923995