Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-11-27
15:26 • Pending ticket [afa8c9f5bb]: Error in an execution trace reports line 1 and lose... artifact: 82c415b0ef user: jan.nijtmans
2026-10-17
12:10 • Ticket [afa8c9f5bb]: 3 changes artifact: ea23b02d8c user: serhiy.storchaka
12:01
Fix [afa8c9f5bb]: an error in an execution trace lost the frame of the traced command and its line n... check-in: 74b2ba4e13 user: serhiy.storchaka tags: trace-error-keep-frame
2013-09-05
12:31
[010f4162ef] Repair effect of trace errors on -errorinfo and -errorstack. closed check-in: f0e808cc64 user: dgp tags: mig-review
12:31 • Closed ticket [010f4162ef]: Restored trace errors => stammering errorstacks</... artifact: e946bbd1bf user: dgp
2013-09-04
15:41 • Ticket [010f4162ef]: 3 changes artifact: 23cfae5e9a user: dgp
15:08 • Ticket [010f4162ef]: 3 changes artifact: fee8883af0 user: ferrieux
2013-09-02
18:48 • Ticket [010f4162ef]: 4 changes artifact: 8ac6a89f8e user: dgp
18:00 • Ticket [010f4162ef]: 4 changes artifact: 2a83db9414 user: dgp
17:59
[010f4162ef] First step of fix on stammering errorstack. errorstack fixed. errorinfo revision still... check-in: 909dcc2cf0 user: dgp tags: bug-010f4162ef
2013-09-01
00:59 • Ticket [010f4162ef] Restored trace errors => stammering errorstacks statu... artifact: 4c16ebab78 user: ferrieux
00:56 • New ticket [010f4162ef]. artifact: 96fe0fe695 user: ferrieux

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:47
  • ea23b02d8cTicket [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:54
  • 74b2ba4e13Fix [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:32
  • f0e808cc64[010f4162ef] Repair effect of trace errors on -errorinfo and -errorstack. check-in2013-09-05 12:31:46
  • 909dcc2cf0[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.