Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: afb5ab69138c1b27c99a874a44f1d65fd1ab404e
Ticket: 1458266fffffffffffffffffffffffffffffffff
cmd execution traces interfere with step execution traces
User & Date: eriklns on 2006-03-26 04:19:08
Changes

  1. icomment:
    Logged In: YES 
    user_id=113903
    
    The following patch remedies the observed behaviour. It
    concerns the function TraceExecutionProc() in tclCmdMZ.c.
    
    Original code (Tcl8.4.12)
    =========================
    
        tcmdPtr->flags |= TCL_TRACE_EXEC_IN_PROGRESS;
        iPtr->flags    |= INTERP_TRACE_IN_PROGRESS;
        tcmdPtr->refCount++;
        /* 
         * This line can have quite arbitrary side-effects,
         * including deleting the trace, the command being
         * traced, or even the interpreter.
         */
        traceCode = Tcl_Eval(interp, Tcl_DStringValue(&cmd));
        tcmdPtr->flags &= ~TCL_TRACE_EXEC_IN_PROGRESS;
        iPtr->flags    &= ~INTERP_TRACE_IN_PROGRESS;
    
    Replacement
    ===========
    
    /*
     * Save the state regarding interpreter wide tracing to
     * restore it after invoking the callback. This prevents
     * any subsequent command traces at a deeper nesting level
     * from affecting the interp trace flags.
     */
        int saveInterpFlags = iPtr->flags;
        iPtr->flags    |= INTERP_TRACE_IN_PROGRESS;
        tcmdPtr->refCount++;
        /* 
         * This line can have quite arbitrary side-effects,
         * including deleting the trace, the command being
         * traced, or even the interpreter.
         */
        traceCode = Tcl_Eval(interp, Tcl_DStringValue(&cmd));
        tcmdPtr->flags &= ~TCL_TRACE_EXEC_IN_PROGRESS;
    
    /*
     * Restore the state regarding interpreter wide tracing
     */
        iPtr->flags = saveInterpFlags;
    
    
    End of patch
    ============
    
    
    
  2. login: "eriklns"
  3. mimetype: "text/plain"
  4. username: "eriklns"