diff options
author | dgp <dgp@users.sourceforge.net> | 2013-09-05 12:31:46 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2013-09-05 12:31:46 (GMT) |
commit | 829487df7256479f7042811865db78b33f6a89d3 (patch) | |
tree | b082adbabe0891b51eda8c866612fef1780ef63f /generic/tclBasic.c | |
parent | 0a973a55fed4b9cba1558fc7c93d412665f7063c (diff) | |
parent | bfee748b41a556c2c213d22b99ce12b156acb1d8 (diff) | |
download | tcl-829487df7256479f7042811865db78b33f6a89d3.zip tcl-829487df7256479f7042811865db78b33f6a89d3.tar.gz tcl-829487df7256479f7042811865db78b33f6a89d3.tar.bz2 |
[010f4162ef] Repair effect of trace errors on -errorinfo and -errorstack.mig_review
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r-- | generic/tclBasic.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 884b5cc..a10a11a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4679,6 +4679,15 @@ TEOV_RunEnterTraces( TclCleanupCommandMacro(cmdPtr); if (traceCode != TCL_OK) { + if (traceCode == TCL_ERROR) { + Tcl_Obj *info; + + TclNewLiteralStringObj(info, "\n (enter trace on \""); + Tcl_AppendLimitedToObj(info, command, length, 55, "..."); + Tcl_AppendToObj(info, "\")", 2); + Tcl_AppendObjToErrorInfo(interp, info); + iPtr->flags |= ERR_ALREADY_LOGGED; + } return traceCode; } if (cmdEpoch != newEpoch) { @@ -4699,12 +4708,10 @@ TEOV_RunLeaveTraces( Tcl_Obj *commandPtr = data[1]; Command *cmdPtr = data[2]; Tcl_Obj **objv = data[3]; - + int length; + const char *command = Tcl_GetStringFromObj(commandPtr, &length); if (!(cmdPtr->flags & CMD_IS_DELETED)) { - int length; - const char *command = Tcl_GetStringFromObj(commandPtr, &length); - if (cmdPtr->flags & CMD_HAS_EXEC_TRACES){ traceCode = TclCheckExecutionTraces(interp, command, length, cmdPtr, result, TCL_TRACE_LEAVE_EXEC, objc, objv); @@ -4714,7 +4721,6 @@ TEOV_RunLeaveTraces( cmdPtr, result, TCL_TRACE_LEAVE_EXEC, objc, objv); } } - Tcl_DecrRefCount(commandPtr); /* * As cmdPtr is set, TclNRRunCallbacks is about to reduce the numlevels. @@ -4725,8 +4731,18 @@ TEOV_RunLeaveTraces( TclCleanupCommandMacro(cmdPtr); if (traceCode != TCL_OK) { - return traceCode; + if (traceCode == TCL_ERROR) { + Tcl_Obj *info; + + TclNewLiteralStringObj(info, "\n (leave trace on \""); + Tcl_AppendLimitedToObj(info, command, length, 55, "..."); + Tcl_AppendToObj(info, "\")", 2); + Tcl_AppendObjToErrorInfo(interp, info); + iPtr->flags |= ERR_ALREADY_LOGGED; + } + result = traceCode; } + Tcl_DecrRefCount(commandPtr); return result; } |