summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--generic/tclCmdIL.c56
-rw-r--r--tests/info.test30
3 files changed, 55 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 27b5b16..e86606f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-06-16 Andreas Kupries <andreask@activestate.com>
+
+ * generic/tclCmdIL.c (InfoFrameCmd): Backport of fix made on the
+ * tests/info.test: head branch :: Moved the code looking up the
+ information for key 'proc' out of the TCL_LOCATION_BC branch to
+ after the switch, this is common to all frame types. Updated the
+ testsuite to match. This was exposed by the 2008-06-08 commit
+ (Miguel), switching uplevel from direct eval to compilation. Fixes
+ [Bug 1987851].
+
2008-06-12 Andreas Kupries <andreask@activestate.com>
* generic/tclCmdIL.c (InfoFrameCmd): TIP #280 conditional
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index d7f1d5b..861a008 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -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: tclCmdIL.c,v 1.47.2.13 2008/06/12 20:19:29 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclCmdIL.c,v 1.47.2.14 2008/06/16 20:46:15 andreas_kupries Exp $
*/
#include "tclInt.h"
@@ -1130,6 +1130,8 @@ InfoFrameCmd(dummy, interp, objc, objv)
"eval", "eval", "eval", "precompiled", "source", "proc"
};
+ Proc* procPtr = framePtr->framePtr ? framePtr->framePtr->procPtr : NULL;
+
switch (framePtr->type) {
case TCL_LOCATION_EVAL:
/* Evaluation, dynamic script. Type, line, cmd, the latter
@@ -1175,8 +1177,7 @@ InfoFrameCmd(dummy, interp, objc, objv)
/* Execution of bytecode. Talk to the BC engine to fill out
* the frame. */
- CmdFrame f = *framePtr;
- Proc* procPtr = f.framePtr ? f.framePtr->procPtr : NULL;
+ CmdFrame f = *framePtr;
/* Note: Type BC => f.data.eval.path is not used.
* f.data.tebc.codePtr is used instead.
@@ -1200,29 +1201,6 @@ InfoFrameCmd(dummy, interp, objc, objv)
lv [lc ++] = Tcl_NewStringObj ("cmd",-1);
lv [lc ++] = Tcl_NewStringObj (f.cmd.str.cmd, f.cmd.str.len);
-
- if (procPtr != NULL) {
- Tcl_HashEntry* namePtr = procPtr->cmdPtr->hPtr;
- /*
- * ITcl seems to provide us with weird, maybe bogus
- * Command structures (methods?) which may have no
- * HashEntry pointing to the name information, or a
- * HashEntry without owning HashTable. Therefore check
- * again that our data is valid.
- */
- if (namePtr && namePtr->tablePtr) {
- char* procName = Tcl_GetHashKey (namePtr->tablePtr, namePtr);
- char* nsName = procPtr->cmdPtr->nsPtr->fullName;
-
- lv [lc ++] = Tcl_NewStringObj ("proc",-1);
- lv [lc ++] = Tcl_NewStringObj (nsName,-1);
-
- if (strcmp (nsName, "::") != 0) {
- Tcl_AppendToObj (lv [lc-1], "::", -1);
- }
- Tcl_AppendToObj (lv [lc-1], procName, -1);
- }
- }
break;
}
@@ -1248,6 +1226,32 @@ InfoFrameCmd(dummy, interp, objc, objv)
break;
}
+ /*
+ * 'proc'. Common to all frame types. Conditional on having an
+ * associated Procedure CallFrame.
+ */
+
+ if (procPtr != NULL) {
+ Tcl_HashEntry* namePtr = procPtr->cmdPtr->hPtr;
+ /*
+ * ITcl seems to provide us with weird, maybe bogus Command
+ * structures (methods?) which may have no HashEntry pointing
+ * to the name information, or a HashEntry without owning
+ * HashTable. Therefore check again that our data is valid.
+ */
+ if (namePtr && namePtr->tablePtr) {
+ char* procName = Tcl_GetHashKey (namePtr->tablePtr, namePtr);
+ char* nsName = procPtr->cmdPtr->nsPtr->fullName;
+
+ lv [lc ++] = Tcl_NewStringObj ("proc",-1);
+ lv [lc ++] = Tcl_NewStringObj (nsName,-1);
+
+ if (strcmp (nsName, "::") != 0) {
+ Tcl_AppendToObj (lv [lc-1], "::", -1);
+ }
+ Tcl_AppendToObj (lv [lc-1], procName, -1);
+ }
+ }
/* 'level'. Common to all frame types. Conditional on having an
* associated _visible_ CallFrame */
diff --git a/tests/info.test b/tests/info.test
index 3c300dc..22ed8ca 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -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: info.test,v 1.24.2.5 2006/11/28 22:20:02 andreas_kupries Exp $
+# RCS: @(#) $Id: info.test,v 1.24.2.6 2008/06/16 20:46:16 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -746,15 +746,15 @@ test info-22.2 {info frame, bad level absolute} tip280 {
test info-22.3 {info frame, current, relative} tip280 {
info frame 0
-} {type eval line 2 cmd {info frame 0}}
+} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest}
test info-22.4 {info frame, current, relative, nested} tip280 {
set res [info frame 0]
-} {type eval line 2 cmd {info frame 0}}
+} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest}
test info-22.5 {info frame, current, absolute} tip280 {
reduce [info frame 7]
-} {type eval line 2 cmd {info frame 7}}
+} {type eval line 2 cmd {info frame 7} proc ::tcltest::RunTest}
test info-22.6 {info frame, global, relative} tip280 {
reduce [info frame -6]
@@ -767,11 +767,11 @@ test info-22.7 {info frame, global, absolute} tip280 {
test info-22.8 {info frame, basic trace} tip280 {
join [etrace] \n
} {8 {type source line 723 file info.test cmd {info frame $level} proc ::etrace level 0}
-7 {type eval line 2 cmd etrace}
+7 {type eval line 2 cmd etrace proc ::tcltest::RunTest}
6 {type source line 2277 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::RunTest}
-5 {type eval line 1 cmd {::tcltest::RunTest }}
+5 {type eval line 1 cmd {::tcltest::RunTest } proc ::tcltest::Eval}
4 {type source line 1619 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::Eval}
-3 {type eval line 1 cmd ::tcltest::Eval\ \{::tcltest::RunTest\ }
+3 {type eval line 1 cmd ::tcltest::Eval\ \{::tcltest::RunTest\ proc ::tcltest::test}
2 {type source line 1966 file tcltest.tcl cmd {uplevel 1 [list [namespace origin Eval] $command 1]} proc ::tcltest::test}
1 {type source line 767 file info.test cmd test\ info-22.8\ \{info\ frame,\ basic\ trac}}
## The line 1966 is off by 5 from the true value of 1971. This is a knownBug, see testcase 30.0
@@ -792,27 +792,27 @@ test info-23.3 {eval'd info frame, literal} tip280 {
eval {
info frame 0
}
-} {type eval line 2 cmd {info frame 0}}
+} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest}
test info-23.4 {eval'd info frame, semi-dynamic} tip280 {
eval info frame 0
-} {type eval line 1 cmd {info frame 0}}
+} {type eval line 1 cmd {info frame 0} proc ::tcltest::RunTest}
test info-23.5 {eval'd info frame, dynamic} tip280 {
set script {info frame 0}
eval $script
-} {type eval line 1 cmd {info frame 0}}
+} {type eval line 1 cmd {info frame 0} proc ::tcltest::RunTest}
test info-23.6 {eval'd info frame, trace} tip280 {
set script {etrace}
join [eval $script] \n
} {9 {type source line 723 file info.test cmd {info frame $level} proc ::etrace level 0}
-8 {type eval line 1 cmd etrace}
-7 {type eval line 3 cmd {eval $script}}
+8 {type eval line 1 cmd etrace proc ::tcltest::RunTest}
+7 {type eval line 3 cmd {eval $script} proc ::tcltest::RunTest}
6 {type source line 2277 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::RunTest}
-5 {type eval line 1 cmd {::tcltest::RunTest }}
+5 {type eval line 1 cmd {::tcltest::RunTest } proc ::tcltest::Eval}
4 {type source line 1619 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::Eval}
-3 {type eval line 1 cmd ::tcltest::Eval\ \{::tcltest::RunTest\ }
+3 {type eval line 1 cmd ::tcltest::Eval\ \{::tcltest::RunTest\ proc ::tcltest::test}
2 {type source line 1966 file tcltest.tcl cmd {uplevel 1 [list [namespace origin Eval] $command 1]} proc ::tcltest::test}
1 {type source line 806 file info.test cmd test\ info-23.6\ \{eval'd\ info\ frame,\ trac}}
## The line 1966 is off by 5 from the true value of 1971. This is a knownBug, see testcase 30.0
@@ -990,7 +990,7 @@ test info-31.5 {for, script in variable} tip280 {
test info-31.6 {eval, script in variable} tip280 {
eval $body
set res
-} {type eval line 3 cmd {info frame 0}}
+} {type eval line 3 cmd {info frame 0} proc ::tcltest::RunTest}
# -------------------------------------------------------------------------