Restored trace errors => stammering errorstacks
Closed / Fixed010f4162efb3bb6546ef904784a13c3c1a615228Created 13 years agoUpdated 13 years ago
Descriptionplain2013-09-01 00:56:32
Commit [30b7b8d858] "Fix bug #2438181: Incorrect error reporting in traces" leads to the following "stammering errorstack", where an Enter-traced proc fails to appear as a CALL level; instead, its caller's level is repeated:
proc foo args {}
proc goo {} foo
trace add execution foo enter {error bar;#}
catch goo m d
puts [dict get $d -errorstack]
=>
INNER {error bar} CALL goo CALL goo
Prior to this commit one would get
INNER {invokeStk1 foo} CALL goo
which avoided the problem by completely hiding the trace's error.
The problem here is that TclLogCommandInfo (which powers the construction of the error stack), called in TEBC after each error, is now also called for the trace's error, thus adding a level; but since we are in an Enter trace, we have not yet updated the interp, which is still essentially in "goo".
Note that the command string passed to TclLogCommandInfo does contain "foo", hence ::errorInfo in this case is (accidentally) more accurate:
bar
while executing
"error bar"
invoked from within
"foo"
(procedure "goo" line 1)
invoked from within
"goo"
Bottom line: we'd need to
- either give a better sync of command string and interp state
- or provide TclLogCommandInfo with a way of detecting this situation to skip the extra level
Referenced by5
82c415b0efPending ticket [afa8c9f5bb]: Error in an execution trace reports line 1 and loses the traced command's frame in errorInfo plus 7 other changes ticket2026-11-27 15:26:47ea23b02d8cTicket [afa8c9f5bb] Error in an execution trace reports line 1 and loses the traced command's frame in errorInfo status still Open with 3 other changes ticket2026-10-17 12:10:5474b2ba4e13Fix [afa8c9f5bb]: an error in an execution trace lost the frame of the traced command and its line number in errorInfo, because [010f4162ef] marked it as ERR_ALREADY_LOGGED. Use a new flag ERR_STACK_LOGGED instead, which only skips the errorstack level. check-in2026-10-17 12:01:32f0e808cc64[010f4162ef] Repair effect of trace errors on -errorinfo and -errorstack. check-in2013-09-05 12:31:46909dcc2cf0[010f4162ef] First step of fix on stammering errorstack. errorstack fixed. errorinfo revision still under consideration. check-in2013-09-02 17:59:42
ferrieux Ticket [010f4162ef]: 4 changes
[History diff]2013-09-01 00:59:52
dgpplain2013-09-02 18:00:47
branch bug-010f4162ef opened to perfect the fix.
dgpplain2013-09-02 18:48:22
Review the fix on the branch. If acceptable merge to trunk.
ferrieuxplain2013-09-04 15:08:51
It (1) works and (2) is (embarrassingly) elegant.
dgpplain2013-09-04 15:41:04
I don't agree that it is elegant, but it has the virtue of re-using an existing inelegance (ERR_ALREADY_LOGGED) rather than inventing a new one.
dgpplain2013-09-05 12:31:06
fix merged to trunk for 8.6.1
Log in (anonymous is fine) to add a comment.