summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-06-27 18:21:52 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-06-27 18:21:52 (GMT)
commitf0da4e55104381d0a8bf98a2c3dfc4848efc1b3d (patch)
treeab1c0c3edd37a49f30dbb627b0eac08a8d9cebce
parent1b530b0a0e25372430b74d7be4881caa02529f3d (diff)
downloadtcl-f0da4e55104381d0a8bf98a2c3dfc4848efc1b3d.zip
tcl-f0da4e55104381d0a8bf98a2c3dfc4848efc1b3d.tar.gz
tcl-f0da4e55104381d0a8bf98a2c3dfc4848efc1b3d.tar.bz2
* generic/tclTrace.c: Corrected broken trace reversal logic in
* generic/tclTest.c: TclCheckInterpTraces that led to infinite loop * tests/trace.test: when multiple Tcl_CreateTrace traces were set and one of them did not fire due to level restrictions. [Bug 1743931].
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclTest.c20
-rw-r--r--generic/tclTrace.c8
-rw-r--r--tests/trace.test6
4 files changed, 34 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index f20701c..f5eeeb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-06-27 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclTrace.c: Corrected broken trace reversal logic in
+ * generic/tclTest.c: TclCheckInterpTraces that led to infinite loop
+ * tests/trace.test: when multiple Tcl_CreateTrace traces were set
+ and one of them did not fire due to level restrictions. [Bug 1743931].
+
2007-06-26 Don Porter <dgp@users.sourceforge.net>
* generic/tclBasic.c (TclEvalEx): Moved some arrays from the
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 4cf57ce..e7be33f 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTest.c,v 1.110 2007/05/02 20:50:26 kennykb Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.111 2007/06/27 18:21:52 dgp Exp $
*/
#define TCL_TEST
@@ -1213,9 +1213,25 @@ TestcmdtraceCmd(
} else {
return result;
}
+ } else if ( strcmp(argv[1], "doubletest" ) == 0 ) {
+ Tcl_Trace t1, t2;
+
+ Tcl_DStringInit(&buffer);
+ t1 = Tcl_CreateTrace(interp, 1,
+ (Tcl_CmdTraceProc *) CmdTraceProc, (ClientData) &buffer);
+ t2 = Tcl_CreateTrace(interp, 50000,
+ (Tcl_CmdTraceProc *) CmdTraceProc, (ClientData) &buffer);
+ result = Tcl_Eval(interp, argv[2]);
+ if (result == TCL_OK) {
+ Tcl_ResetResult(interp);
+ Tcl_AppendResult(interp, Tcl_DStringValue(&buffer), NULL);
+ }
+ Tcl_DeleteTrace(interp, t2);
+ Tcl_DeleteTrace(interp, t1);
+ Tcl_DStringFree(&buffer);
} else {
Tcl_AppendResult(interp, "bad option \"", argv[1],
- "\": must be tracetest, deletetest or resulttest", NULL);
+ "\": must be tracetest, deletetest, doubletest or resulttest", NULL);
return TCL_ERROR;
}
return TCL_OK;
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 799a764..f4927f8 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclTrace.c,v 1.39 2007/06/20 18:46:14 dgp Exp $
+ * RCS: @(#) $Id: tclTrace.c,v 1.40 2007/06/27 18:21:52 dgp Exp $
*/
#include "tclInt.h"
@@ -1576,6 +1576,9 @@ TclCheckInterpTraces(
active.nextTracePtr = tracePtr;
tracePtr = tracePtr->nextPtr;
}
+ if (active.nextTracePtr) {
+ lastTracePtr = active.nextTracePtr->nextPtr;
+ }
} else {
active.reverseScan = 0;
active.nextTracePtr = tracePtr->nextPtr;
@@ -1635,9 +1638,6 @@ TclCheckInterpTraces(
tracePtr->flags &= ~TCL_TRACE_EXEC_IN_PROGRESS;
Tcl_Release((ClientData) tracePtr);
}
- if (active.nextTracePtr) {
- lastTracePtr = active.nextTracePtr->nextPtr;
- }
}
iPtr->activeInterpTracePtr = active.nextPtr;
if (state) {
diff --git a/tests/trace.test b/tests/trace.test
index 47de94f..a736228 100644
--- a/tests/trace.test
+++ b/tests/trace.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: trace.test,v 1.55 2007/06/21 17:45:40 msofer Exp $
+# RCS: @(#) $Id: trace.test,v 1.56 2007/06/27 18:21:52 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -2306,6 +2306,10 @@ test trace-29.10 {Tcl_CreateTrace, correct level interpretation} {testcmdtrace}
testcmdtrace leveltest {foo}
} {foo {foo} {uplevel 1 bar} {uplevel 1 bar} bar {bar} {uplevel 1 grok} {uplevel 1 grok}}
+test trace-29.11 {Tcl_CreateTrace, multiple traces} {testcmdtrace} {
+ testcmdtrace doubletest {format xx}
+} {{format xx} {format xx}}
+
test trace-30.1 {Tcl_DeleteTrace} {emptyTest} {
# the above tests have tested Tcl_DeleteTrace
} {}