diff options
author | dgp <dgp@users.sourceforge.net> | 2015-06-03 19:08:15 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2015-06-03 19:08:15 (GMT) |
commit | f3337d5804891dde384cbc16b853b551ce5187d0 (patch) | |
tree | 952bc37178fa96cd81f4a94d047e3994a0bb854c /generic | |
parent | 40e080788cc6a4045283e0cc0d4cd3317bfadac3 (diff) | |
download | tcl-f3337d5804891dde384cbc16b853b551ce5187d0.zip tcl-f3337d5804891dde384cbc16b853b551ce5187d0.tar.gz tcl-f3337d5804891dde384cbc16b853b551ce5187d0.tar.bz2 |
[268b23df11] Revised patch to create phony source string when the
original script does not actually contain the command being invoked.
(Example: the tcl::mathfunc::* command invoked via [expr] interpretation)
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclExecute.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 5957951..4a6c009 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8235,6 +8235,7 @@ TEBCresume( bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL, NULL); opnd = TclGetUInt4AtPtr(pc+1); pc += (opnd-1); + assert(bytes); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); goto instEvalStk; } @@ -9900,7 +9901,12 @@ TclGetSourceFromFrame( cfPtr->cmd = GetSrcInfoForPc((unsigned char *) cfPtr->data.tebc.pc, codePtr, &cfPtr->len, NULL, NULL); } - cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + if (cfPtr->cmd) { + cfPtr->cmdObj = Tcl_NewStringObj(cfPtr->cmd, cfPtr->len); + } else { + cfPtr->cmdObj = Tcl_NewListObj(objc, objv); + cfPtr->cmd = Tcl_GetStringFromObj(cfPtr->cmdObj, &cfPtr->len); + } Tcl_IncrRefCount(cfPtr->cmdObj); } return cfPtr->cmdObj; @@ -10081,6 +10087,10 @@ GetSrcInfoForPc( *pcBeg = prev; } + if (bestDist == INT_MAX) { + return NULL; + } + if (lengthPtr != NULL) { *lengthPtr = bestSrcLength; } @@ -10089,10 +10099,6 @@ GetSrcInfoForPc( *cmdIdxPtr = bestCmdIdx; } - if (bestDist == INT_MAX) { - return NULL; - } - return (codePtr->source + bestSrcOffset); } |