summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-02-06 17:41:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-02-06 17:41:38 (GMT)
commit62bcbbe491c462f2c23e91ec9f3feb172581f322 (patch)
tree64c0f1078c641bbb79dff5101d117d0c3b2836fc
parent8b58a90083b194bedf76d69e03823eaeeac7171f (diff)
parentd96696676a3d3487daa023f4f916533b06d4c25e (diff)
downloadtcl-62bcbbe491c462f2c23e91ec9f3feb172581f322.zip
tcl-62bcbbe491c462f2c23e91ec9f3feb172581f322.tar.gz
tcl-62bcbbe491c462f2c23e91ec9f3feb172581f322.tar.bz2
3485022 TclCompileEnsemble() avoid compile when exec traces set.
-rw-r--r--ChangeLog5
-rw-r--r--generic/tclEnsemble.c3
-rw-r--r--tests/trace.test28
3 files changed, 35 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 26749ed..a21cc5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-06 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclEnsemble.c: [Bug 3485022] TclCompileEnsemble() avoid
+ * tests/trace.test: compile when exec traces set.
+
2012-02-06 Miguel Sofer <msofer@users.sf.net>
* generic/tclTrace.c: Fix for [Bug 3484621]: insure that
diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c
index 1c7b41d..23b5cbc 100644
--- a/generic/tclEnsemble.c
+++ b/generic/tclEnsemble.c
@@ -2889,7 +2889,8 @@ TclCompileEnsemble(
Tcl_IncrRefCount(targetCmdObj);
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, targetCmdObj);
TclDecrRefCount(targetCmdObj);
- if (cmdPtr == NULL || cmdPtr->compileProc == NULL) {
+ if (cmdPtr == NULL || cmdPtr->compileProc == NULL
+ || cmdPtr->flags * CMD_HAS_EXEC_TRACES) {
/*
* Maps to an undefined command or a command without a compiler.
* Cannot compile.
diff --git a/tests/trace.test b/tests/trace.test
index 254ff62..693dbad 100644
--- a/tests/trace.test
+++ b/tests/trace.test
@@ -2591,8 +2591,36 @@ test trace-39 {bug #3484621: tracing Bc'ed commands} -setup {
rename foo {}
} -result {3 | 0 1 1}
+test trace-39.1 {bug #3485022: tracing Bc'ed commands} -setup {
+ set ::traceLog 0
+ set ::traceCalls 0
+ set res {}
+ proc dotrace args {
+ incr ::traceLog
+ }
+ proc foo {} {
+ incr ::traceCalls
+ string equal zip zap
+ }
+} -body {
+ foo
+ lappend res $::traceLog
+ trace add execution ::tcl::string::equal enter dotrace
+ foo
+ lappend res $::traceLog
+
+ trace remove execution tcl::string::equal enter dotrace
+ foo
+ lappend res $::traceLog
+ list $::traceCalls | {*}$res
+} -cleanup {
+ unset ::traceLog ::traceCalls res
+ rename dotrace {}
+ rename foo {}
+} -result {3 | 0 1 1}
+
# Delete procedures when done, so we don't clash with other tests
# (e.g. foobar will clash with 'unknown' tests).
catch {rename foobar {}}