summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-03-01 17:33:20 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-03-01 17:33:20 (GMT)
commit533cffb36c60635f6401dd91acb3ce4ca0013d07 (patch)
treec5f8a52e4ead68a57c0a6f060d407c63f58f6307
parent754c0852ab501fec0150360756a06d3918a9cc25 (diff)
downloadtcl-533cffb36c60635f6401dd91acb3ce4ca0013d07.zip
tcl-533cffb36c60635f6401dd91acb3ce4ca0013d07.tar.gz
tcl-533cffb36c60635f6401dd91acb3ce4ca0013d07.tar.bz2
* generic/tclCmdMZ.c (TclCheckInterpTraces): The TIP 62
* generic/tclTest.c (TestcmdtraceCmd): implementation introduced a * tests/basic.test (basic-39.10): bug by testing the CallFrame level instead of the iPtr->numLevels level when deciding what traces created by Tcl_Create(Obj)Trace to call. Added test to expose the error, and made fix. [Request 462580]
-rw-r--r--ChangeLog9
-rw-r--r--generic/tclCmdMZ.c4
-rw-r--r--generic/tclTest.c14
-rw-r--r--tests/basic.test11
4 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bef0d58..363ec88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-03-01 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclCmdMZ.c (TclCheckInterpTraces): The TIP 62
+ * generic/tclTest.c (TestcmdtraceCmd): implementation introduced a
+ * tests/basic.test (basic-39.10): bug by testing the CallFrame
+ level instead of the iPtr->numLevels level when deciding what traces
+ created by Tcl_Create(Obj)Trace to call. Added test to expose the
+ error, and made fix. [Request 462580]
+
2004-02-26 Daniel Steffen <das@users.sourceforge.net>
*** 8.4.6 TAGGED FOR RELEASE ***
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 53f9cb1..09c3853 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.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: tclCmdMZ.c,v 1.82.2.10 2004/02/17 04:54:51 hobbs Exp $
+ * RCS: @(#) $Id: tclCmdMZ.c,v 1.82.2.11 2004/03/01 17:33:21 dgp Exp $
*/
#include "tclInt.h"
@@ -4305,7 +4305,7 @@ TclCheckInterpTraces(interp, command, numChars, cmdPtr, code,
return(traceCode);
}
- curLevel = ((iPtr->varFramePtr == NULL) ? 0 : iPtr->varFramePtr->level);
+ curLevel = iPtr->numLevels;
active.nextPtr = iPtr->activeInterpTracePtr;
iPtr->activeInterpTracePtr = &active;
diff --git a/generic/tclTest.c b/generic/tclTest.c
index d0b2bab..2695920 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.62.2.6 2004/02/20 20:44:47 dgp Exp $
+ * RCS: @(#) $Id: tclTest.c,v 1.62.2.7 2004/03/01 17:33:21 dgp Exp $
*/
#define TCL_TEST
@@ -1129,6 +1129,18 @@ TestcmdtraceCmd(dummy, interp, argc, argv)
cmdTrace = Tcl_CreateTrace(interp, 50000,
(Tcl_CmdTraceProc *) CmdTraceDeleteProc, (ClientData) NULL);
Tcl_Eval(interp, argv[2]);
+ } else if (strcmp(argv[1], "leveltest") == 0) {
+ Interp *iPtr = (Interp *) interp;
+ Tcl_DStringInit(&buffer);
+ cmdTrace = Tcl_CreateTrace(interp, iPtr->numLevels + 4,
+ (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, cmdTrace);
+ Tcl_DStringFree(&buffer);
} else if ( strcmp(argv[1], "resulttest" ) == 0 ) {
/* Create an object-based trace, then eval a script. This is used
* to test return codes other than TCL_OK from the trace engine.
diff --git a/tests/basic.test b/tests/basic.test
index c86111c..cc35cbe 100644
--- a/tests/basic.test
+++ b/tests/basic.test
@@ -15,7 +15,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: basic.test,v 1.25.2.2 2004/02/25 23:38:15 dgp Exp $
+# RCS: @(#) $Id: basic.test,v 1.25.2.3 2004/03/01 17:33:22 dgp Exp $
#
package require tcltest 2
@@ -536,6 +536,15 @@ test basic-39.9 {Tcl_CreateObjTrace, status return unknown} {testcmdtrace} {
list [catch {testcmdtrace resulttest {OtherStatus $x}} result] [set result]
} {6 {}}
+test basic-39.10 {Tcl_CreateTrace, correct level interpretation} {testcmdtrace} {
+ proc foo {} {uplevel 1 bar}
+ proc bar {} {uplevel 1 grok}
+ proc grok {} {uplevel 1 spock}
+ proc spock {} {uplevel 1 fascinating}
+ proc fascinating {} {}
+ testcmdtrace leveltest {foo}
+} {foo {foo} {uplevel 1 bar} {uplevel 1 bar} bar {bar} {uplevel 1 grok} {uplevel 1 grok}}
+
test basic-40.1 {Tcl_DeleteTrace} {emptyTest} {
# the above tests have tested Tcl_DeleteTrace
} {}