Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-11-04
01:12 • Ticket [527164ffff] ::errorInfo lost in variable traces status still Closed ... artifact: f0bec17bd3 user: dgp
01:12 • Add attachment tk.patch to ticket [527164ffff] artifact: bb552bbeae user: dgp
01:12 • Ticket [527164ffff] ::errorInfo lost in variable traces status still Closed ... artifact: 0697198369 user: dgp
00:12 • Closed ticket [527164ffff]. artifact: 47f984e030 user: dgp
00:12 • Add attachment 527164.patch to ticket [527164ffff] artifact: 71aa417fe8 user: dgp
2004-11-03
23:24 • Ticket [527164ffff] ::errorInfo lost in variable traces status still Open wi... artifact: a06133928e user: dgp
20:37 • Ticket [527164ffff]: 5 changes artifact: 259470c340 user: dkf
04:45 • Ticket [527164ffff]: 4 changes artifact: 1baddc525c user: dgp
04:45 • Ticket [527164ffff]: 6 changes artifact: 8696a3d6e3 user: dgp
2004-10-30
09:24 • Ticket [527164ffff]: 5 changes artifact: 638440bde4 user: dgp
2003-06-26
22:47 • Ticket [527164ffff]: 1 change artifact: c2f4d63b98 user: dgp
17:31 • Ticket [527164ffff]: 1 change artifact: 5514a5bb42 user: dkf
2002-03-29
07:07 • Ticket [527164ffff]: 4 changes artifact: 683903fe87 user: dgp
00:19 • Ticket [527164ffff]: 4 changes artifact: 345d073844 user: dgp
2002-03-28
23:53 • Ticket [527164ffff]: 4 changes artifact: 4b3079423a user: dgp
11:21 • Ticket [527164ffff]: 4 changes artifact: d91175e798 user: dgp
05:36 • Ticket [527164ffff]: 4 changes artifact: 63e3e3cba9 user: dgp
2002-03-08
20:13 • Ticket [527164ffff]: 4 changes artifact: ec52460c80 user: dkf
05:38 • Ticket [527164ffff]: 4 changes artifact: 3112a5568f user: dgp
05:21 • Ticket [527164ffff]: 4 changes artifact: 655a8776f7 user: msofer
2002-03-07
21:46 • New ticket [527164ffff]. artifact: e8046f0d80 user: dgp

::errorInfo lost in variable traces

Closed / Fixed527164ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 22 years ago
Descriptionplain2002-03-07 21:46:03
When an error occurs in a variable trace with
message $msg, the operation on the variable returns
an stack trace like:

can't set "foo": $msg
    while executing
set foo bar

Unless all your error messages are unique, or you
never put multiple traces on a variable (and never
chain traces), that's not enough information to
find the problem.  Debugging variable traces is
thus much harder than it should be.

I would rather the stack trace were like:

$msg
<rest of stack trace, formerly lost>
    (write trace on "foo")
    while executing
set foo bar

This can be done by not calling VarErrMsg when
reporting errors in variable traces.

Any reason not to make this change?
msoferplain2002-03-08 05:21:54
Logged In: YES 
user_id=148712

I do not see any reason not to, except maybe that some app
might possibly be relying on the precise wording of the
stack trace.

By the way, if we do change errorInfo details: I'd like to
get rid of the distinction between "while executing" and
"invoked from" - I'm having quite a bit of trouble
reproducing that exact structure in an attempt to have
errorInfo be generated lazily. So, either there is no real
logic behind that distinction, or else I'm missing it
completely. Any reason not to unify those messages too?
dgpplain2002-03-08 05:38:49
Logged In: YES 
user_id=80530


That's also worth considering, but I think it's a
separate issue from the request in this report,
and I'd like to consider it separately.
dkfplain2002-03-08 20:13:36
Logged In: YES 
user_id=79902

Integrating variable trace failures with the other errors
that can happen when reading or writing a variable is a bit
of a pain (TIP #68 cleaned this up a bit, but it still isn't
pretty); at the moment there is no way to indicate whether a
particular message came from a trace or from somewhere else,
which is exactly what you need when trying to work out
whether to reinitialise the errorInfo variable.
dgpplain2002-03-28 05:36:38
Logged In: YES 
user_id=80530

Note that after accepting Patch 535952, this change can
be made by modifications to a single routine, CallTraces.
dgpplain2002-03-28 11:21:54
File Added - 20173: vartrace.patch

Logged In: YES 
user_id=80530


Here's a patch that includes the effects of Patch 535952
and the additional changes to preserve ::errorInfo
from variable traces.

It does not include updates to the test suite, neither
changes to existing tests, nor new tests to test the new
functionality.
dgpplain2002-03-28 23:53:33
Logged In: YES 
user_id=80530

patch does not appear to work.
dgpplain2002-03-29 00:19:46
Logged In: YES 
user_id=80530


OK, the patched Call Traces will now preserve
any stack trace info that's already in ::errorInfo.

The problem is that TraceVarProc calls
Tcl_RestoreResult which in turn calls
Tcl_ResetResult.  This destroys all stack
information in ::errorInfo before control
ever gets back to CallTraces.

Note sure whether this can be fixed.  The calls
to Tcl_SaveResult and Tcl_RestoreResult in
TraceVarProc could be removed, but that might
break the interface of traces.  Tcl_RestoreResult
could be changed to not call Tcl_ResetResult, but
that also might be an incompatible interface change.
dgpplain2002-03-29 07:07:44
File Deleted - 20173: 



File Added - 20232: vartrace.patch

Logged In: YES 
user_id=80530

Patch updated to the current HEAD.  Stil does not work.
dkf Ticket [527164ffff]: 1 change [History diff]2003-06-26 17:31:20
dgp Ticket [527164ffff]: 1 change [History diff]2003-06-26 22:47:05
dgpplain2004-10-30 09:24:05
Logged In: YES 
user_id=80530

worth another look now.
dgpplain2004-11-03 04:45:10
Logged In: YES 
user_id=80530

patch updated to HEAD.
needs review and tests
(new and revised)
dgpplain2004-11-03 04:45:11
File Deleted - 20232: 



File Added - 107412: 527164.patch
dkfplain2004-11-03 20:37:04
Logged In: YES 
user_id=79902

Patch looks likely to succeed and I approve of the general
change. Assigning back to author for test suite updates.
dgpplain2004-11-03 23:24:20
File Deleted - 107412: 



File Added - 107483: 527164.patch

Logged In: YES 
user_id=80530

updated patch provides the
::errorInfo preserving
benefits, but keeps much
better compatibility.
dgpplain2004-11-04 00:12:11
File Deleted - 107483: 



File Added - 107490: 527164.patch

Logged In: YES 
user_id=80530

final patch includes test suite updates.

committing for Tcl 8.5a2.

Debugging errors in traces should
be much easier now.
dgpplain2004-11-04 01:12:18
Logged In: YES 
user_id=80530

additional patch for Tk test suite.
dgpplain2004-11-04 01:12:19
File Added - 107497: tk.patch
Log in (anonymous is fine) to add a comment.

Attachments: