summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2011-01-19 08:14:16 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2011-01-19 08:14:16 (GMT)
commitcec54eeb88fbfdfbaca596a2d81ca64d71a18ece (patch)
treef0bed6f37011d9eb1defcb62d03b82d097671363
parent53f76ae4c76d0f42251c53a6752d5767c23c20b0 (diff)
downloadtcl-cec54eeb88fbfdfbaca596a2d81ca64d71a18ece.zip
tcl-cec54eeb88fbfdfbaca596a2d81ca64d71a18ece.tar.gz
tcl-cec54eeb88fbfdfbaca596a2d81ca64d71a18ece.tar.bz2
Backport of Miguel's 2010-09-22 fix on 8.6 branch (decache stack info wherever ::errorInfo may be updated, for trace sanity). [Bug 3138178]
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclExecute.c40
2 files changed, 45 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a53a3e7..6b9032f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-19 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
+
+ * generic/tclExecute.c: Backport of Miguel's 2010-09-22 fix on 8.6
+ branch (decache stack info wherever ::errorInfo may be updated,
+ for trace sanity). [Bug 3138178]
+
2011-01-19 Jan Nijtmans <nijtmans@users.sf.net>
* tools/genStubs.tcl: Make sure to use CONST/VOID in stead of
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 3f9c439..90d3782 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclExecute.c,v 1.369.2.20 2011/01/13 11:30:12 msofer Exp $
+ * RCS: @(#) $Id: tclExecute.c,v 1.369.2.21 2011/01/19 08:14:17 ferrieux Exp $
*/
#include "tclInt.h"
@@ -3695,7 +3695,9 @@ TclExecuteByteCode(
if (result != TCL_OK) {
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -3703,7 +3705,9 @@ TclExecuteByteCode(
if (result != TCL_OK) {
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(value2Ptr),
(value2Ptr->typePtr? value2Ptr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, value2Ptr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -4811,7 +4815,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 1st TYPE %s\n", O2S(valuePtr),
O2S(value2Ptr), (valuePtr->typePtr?
valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -4822,7 +4828,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 2nd TYPE %s\n", O2S(valuePtr),
O2S(value2Ptr), (value2Ptr->typePtr?
value2Ptr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, value2Ptr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -5270,7 +5278,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 1st TYPE %s\n", O2S(valuePtr),
O2S(value2Ptr), (valuePtr->typePtr?
valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
result = GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2);
@@ -5280,7 +5290,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 2nd TYPE %s\n", O2S(valuePtr),
O2S(value2Ptr), (value2Ptr->typePtr?
value2Ptr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, value2Ptr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -5518,7 +5530,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 1st TYPE %s\n",
O2S(value2Ptr), O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name: "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -5542,7 +5556,9 @@ TclExecuteByteCode(
TRACE(("%.20s %.20s => ILLEGAL 2nd TYPE %s\n",
O2S(value2Ptr), O2S(valuePtr),
(value2Ptr->typePtr? value2Ptr->typePtr->name: "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, value2Ptr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
@@ -5613,7 +5629,9 @@ TclExecuteByteCode(
if (TclIsNaN(dResult)) {
TRACE(("%.20s %.20s => IEEE FLOATING PT ERROR\n",
O2S(valuePtr), O2S(value2Ptr)));
+ DECACHE_STACK_INFO();
TclExprFloatError(interp, dResult);
+ CACHE_STACK_INFO();
result = TCL_ERROR;
goto checkForCatch;
}
@@ -6267,7 +6285,9 @@ TclExecuteByteCode(
if (result != TCL_OK) {
TRACE(("\"%.20s\" => ILLEGAL TYPE %s\n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
/* TODO: Consider peephole opt. */
@@ -6291,7 +6311,9 @@ TclExecuteByteCode(
result = TCL_ERROR;
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
if (type == TCL_NUMBER_LONG) {
@@ -6342,7 +6364,9 @@ TclExecuteByteCode(
result = TCL_ERROR;
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name : "null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
}
switch (type) {
@@ -6441,7 +6465,9 @@ TclExecuteByteCode(
result = TCL_ERROR;
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name:"null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
goto checkForCatch;
} else {
/* ... TryConvertToNumeric($NonNumeric) is acceptable */
@@ -6459,7 +6485,9 @@ TclExecuteByteCode(
TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr),
(valuePtr->typePtr? valuePtr->typePtr->name:"null")));
+ DECACHE_STACK_INFO();
IllegalExprOperandType(interp, pc, valuePtr);
+ CACHE_STACK_INFO();
} else {
/*
* Numeric conversion of NaN -> error.
@@ -6467,7 +6495,9 @@ TclExecuteByteCode(
TRACE(("\"%.20s\" => IEEE FLOATING PT ERROR\n",
O2S(objResultPtr)));
+ DECACHE_STACK_INFO();
TclExprFloatError(interp, *((const double *)ptr));
+ CACHE_STACK_INFO();
}
goto checkForCatch;
}
@@ -6711,7 +6741,9 @@ TclExecuteByteCode(
case INST_END_CATCH:
catchTop--;
+ DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
+ CACHE_STACK_INFO();
result = TCL_OK;
TRACE(("=> catchTop=%d\n", (int) (catchTop - initCatchTop - 1)));
NEXT_INST_F(1, 0, 0);
@@ -6775,9 +6807,11 @@ TclExecuteByteCode(
"%u => ERROR reading leaf dictionary key \"%s\": ",
opnd, O2S(dictPtr)), Tcl_GetObjResult(interp));
} else {
+ DECACHE_STACK_INFO();
Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "key \"", TclGetString(OBJ_AT_TOS),
"\" not known in dictionary", NULL);
+ CACHE_STACK_INFO();
TRACE_WITH_OBJ(("%u => ERROR ", opnd), Tcl_GetObjResult(interp));
result = TCL_ERROR;
}
@@ -7248,8 +7282,10 @@ TclExecuteByteCode(
*/
divideByZero:
+ DECACHE_STACK_INFO();
Tcl_SetObjResult(interp, Tcl_NewStringObj("divide by zero", -1));
Tcl_SetErrorCode(interp, "ARITH", "DIVZERO", "divide by zero", NULL);
+ CACHE_STACK_INFO();
result = TCL_ERROR;
goto checkForCatch;
@@ -7260,10 +7296,12 @@ TclExecuteByteCode(
*/
exponOfZero:
+ DECACHE_STACK_INFO();
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"exponentiation of zero by negative power", -1));
Tcl_SetErrorCode(interp, "ARITH", "DOMAIN",
"exponentiation of zero by negative power", NULL);
+ CACHE_STACK_INFO();
result = TCL_ERROR;
goto checkForCatch;