summaryrefslogtreecommitdiffstats
path: root/generic/tclExecute.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-08-10 05:16:38 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-08-10 05:16:38 (GMT)
commitde857ca207e4dceea586bf2dbfe497df4d9d02c8 (patch)
tree8047783a9771beff85554397a4263d1d93acde9b /generic/tclExecute.c
parentfec32bb50c597bfbb21ad55211339355034f6d55 (diff)
downloadtcl-de857ca207e4dceea586bf2dbfe497df4d9d02c8.zip
tcl-de857ca207e4dceea586bf2dbfe497df4d9d02c8.tar.gz
tcl-de857ca207e4dceea586bf2dbfe497df4d9d02c8.tar.bz2
Arrange for both execution traces and [info frame] to get their pre-subst
source strings from a common routine, with care taken to reduce copying by that routine.
Diffstat (limited to 'generic/tclExecute.c')
-rw-r--r--generic/tclExecute.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index f6072a1..d8ccf40 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -2006,6 +2006,7 @@ TclNRExecuteByteCode(
bcFramePtr->litarg = NULL;
bcFramePtr->data.tebc.codePtr = codePtr;
bcFramePtr->data.tebc.pc = NULL;
+ bcFramePtr->cmdObj = NULL;
bcFramePtr->cmd = NULL;
bcFramePtr->len = 0;
@@ -2130,6 +2131,11 @@ TEBCresume(
result = TCL_ERROR;
}
NRE_ASSERT(iPtr->cmdFramePtr == bcFramePtr);
+ if (bcFramePtr->cmdObj) {
+ Tcl_DecrRefCount(bcFramePtr->cmdObj);
+ bcFramePtr->cmdObj = NULL;
+ bcFramePtr->cmd = NULL;
+ }
iPtr->cmdFramePtr = bcFramePtr->nextPtr;
if (iPtr->flags & INTERP_DEBUG_FRAME) {
TclArgumentBCRelease((Tcl_Interp *) iPtr, bcFramePtr);
@@ -8761,7 +8767,14 @@ TclGetSrcInfoForCmd(
Interp *iPtr,
int *lenPtr)
{
- CmdFrame *cfPtr = iPtr->cmdFramePtr;
+ return TclGetSrcInfoForCmdFrame(iPtr->cmdFramePtr, lenPtr);
+}
+
+const char *
+TclGetSrcInfoForCmdFrame(
+ CmdFrame *cfPtr,
+ int *lenPtr)
+{
ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
return GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc,
@@ -8775,11 +8788,13 @@ TclGetSrcInfoForPc(
ByteCode *codePtr = (ByteCode *) cfPtr->data.tebc.codePtr;
assert(cfPtr->type == TCL_LOCATION_BC);
- assert(cfPtr->cmd == NULL);
+
+ if (cfPtr->cmd == NULL) {
cfPtr->cmd = GetSrcInfoForPc(
(unsigned char *) cfPtr->data.tebc.pc, codePtr,
&cfPtr->len, NULL, NULL);
+ }
assert(cfPtr->cmd != NULL);
{