diff options
author | dgp <dgp@users.sourceforge.net> | 2003-10-02 18:08:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2003-10-02 18:08:31 (GMT) |
commit | 2f410aca8409714a2f94c7147384ebf8750b2518 (patch) | |
tree | 6013e009956ff5fcf1cb8628f33b2e7ba6fcd6a2 | |
parent | d49289c17822ead42e5cfe52143417e665af957e (diff) | |
download | tcl-2f410aca8409714a2f94c7147384ebf8750b2518.zip tcl-2f410aca8409714a2f94c7147384ebf8750b2518.tar.gz tcl-2f410aca8409714a2f94c7147384ebf8750b2518.tar.bz2 |
* generic/tclTrace.c: Corrected comingling of introspection results of
[trace info command] and [trace info execution]. [Bug 807243]
Thanks to Mark Saye.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclTrace.c | 18 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2003-10-02 Don Porter <dgp@users.sourceforge.net> + + * generic/tclTrace.c: Corrected comingling of introspection results of + [trace info command] and [trace info execution]. [Bug 807243] + Thanks to Mark Saye. + 2003-10-01 Daniel Steffen <das@users.sourceforge.net> * macosx/Makefile: fixed redo prebinding bug when DESTDIR="". diff --git a/generic/tclTrace.c b/generic/tclTrace.c index 6e8d6dd..be49d7b 100644 --- a/generic/tclTrace.c +++ b/generic/tclTrace.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTrace.c,v 1.4 2003/07/16 08:26:08 dkf Exp $ + * RCS: @(#) $Id: tclTrace.c,v 1.5 2003/10/02 18:08:31 dgp Exp $ */ #include "tclInt.h" @@ -599,6 +599,7 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) resultListPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); while ((clientData = Tcl_CommandTraceInfo(interp, name, 0, TraceCommandProc, clientData)) != NULL) { + int numOps = 0; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *) clientData; @@ -612,6 +613,7 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) */ elemObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); + Tcl_IncrRefCount(elemObjPtr); if (tcmdPtr->flags & TCL_TRACE_ENTER_EXEC) { Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("enter",5)); @@ -628,7 +630,13 @@ TclTraceExecutionObjCmd(interp, optionIndex, objc, objv) Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("leavestep",9)); } + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); + if (0 == numOps) { + Tcl_DecrRefCount(elemObjPtr); + continue; + } Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); + Tcl_DecrRefCount(elemObjPtr); elemObjPtr = NULL; Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, @@ -794,6 +802,7 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) resultListPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); while ((clientData = Tcl_CommandTraceInfo(interp, name, 0, TraceCommandProc, clientData)) != NULL) { + int numOps = 0; TraceCommandInfo *tcmdPtr = (TraceCommandInfo *) clientData; @@ -807,6 +816,7 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) */ elemObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL); + Tcl_IncrRefCount(elemObjPtr); if (tcmdPtr->flags & TCL_TRACE_RENAME) { Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("rename",6)); @@ -815,7 +825,13 @@ TclTraceCommandObjCmd(interp, optionIndex, objc, objv) Tcl_ListObjAppendElement(NULL, elemObjPtr, Tcl_NewStringObj("delete",6)); } + Tcl_ListObjLength(NULL, elemObjPtr, &numOps); + if (0 == numOps) { + Tcl_DecrRefCount(elemObjPtr); + continue; + } Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); + Tcl_DecrRefCount(elemObjPtr); elemObjPtr = Tcl_NewStringObj(tcmdPtr->command, -1); Tcl_ListObjAppendElement(NULL, eachTraceObjPtr, elemObjPtr); |