From 38420f3643011c20be92daaaa3957535dc0dfdb2 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 28 May 2010 08:30:48 +0000 Subject: * generic/tclExecute.c (TclExecuteByteCode): Restore correct operation of instruction-level execution tracing (had been broken by NRE). --- ChangeLog | 33 +++++++++++++++++++-------------- generic/tclExecute.c | 36 +++++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index ebd47f3..a749a87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18 +1,23 @@ +2010-05-28 Donal K. Fellows + + * generic/tclExecute.c (TclExecuteByteCode): Restore correct operation + of instruction-level execution tracing (had been broken by NRE). + 2010-05-27 Jan Nijtmans - * library/opt/optParse.tcl Don't generate spaces at the end of a line, - * library/opt/pkgIndex.tcl eliminate ';' at line end, bump to v0.4.6 - * tools/uniParse.tcl - * generic/tclUniData.c - * tests/opt.test - * tests/safe.test + * library/opt/optParse.tcl: Don't generate spaces at the end of a + * library/opt/pkgIndex.tcl: line, eliminate ';' at line end, bump to + * tools/uniParse.tcl: v0.4.6 + * generic/tclUniData.c: + * tests/opt.test: + * tests/safe.test: 2010-05-21 Jan Nijtmans - * tools/installData.tcl Make sure that copyDir only receives normalized - paths, otherwise it might result in a crash on CYGWIN. restyle according - to the Tcl style guide (http://www.tcl.tk/doc/styleGuide.pdf) - * generic/tclStrToD.c: [Bug #3005233] fix for build on OpenBSD vax + * tools/installData.tcl: Make sure that copyDir only receives + normalized paths, otherwise it might result in a crash on CYGWIN. + Restyle according to the Tcl style guide. + * generic/tclStrToD.c: [Bug 3005233]: Fix for build on OpenBSD vax 2010-05-19 Alexandre Ferrieux @@ -22,13 +27,13 @@ 2010-05-19 Jan Nijtmans - * generic/regcomp.c Don't use arrays of length 1, just use a single - * generic/tclFileName.c element then, it makes code more readable. - * generic/tclLoad.c (here it even prevents a type cast) + * generic/regcomp.c: Don't use arrays of length 1, just use a + * generic/tclFileName.c: single element then, it makes code more + * generic/tclLoad.c: readable. (Here it even prevents a type cast) 2010-05-17 Jan Nijtmans - * generic/tclStrToD.c: Fix [Bug 2996549]: Failure in expr.test on Win32 + * generic/tclStrToD.c: [Bug 2996549]: Failure in expr.test on Win32 2010-05-17 Donal K. Fellows diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d6dd352..7a69673 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.482 2010/04/30 08:29:40 dkf Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.483 2010/05/28 08:30:49 dkf Exp $ */ #include "tclInt.h" @@ -359,7 +359,7 @@ VarHashCreateVar( #ifdef TCL_COMPILE_DEBUG # define TRACE(a) \ - while (traceInstructions) { \ + while (TAUX.traceInstructions) { \ fprintf(stdout, "%2d: %2d (%u) %s ", iPtr->numLevels, \ (int) CURR_DEPTH, \ (unsigned) (pc - codePtr->codeStart), \ @@ -368,12 +368,12 @@ VarHashCreateVar( break; \ } # define TRACE_APPEND(a) \ - while (traceInstructions) { \ + while (TAUX.traceInstructions) { \ printf a; \ break; \ } # define TRACE_WITH_OBJ(a, objPtr) \ - while (traceInstructions) { \ + while (TAUX.traceInstructions) { \ fprintf(stdout, "%2d: %2d (%u) %s ", iPtr->numLevels, \ (int) CURR_DEPTH, \ (unsigned) (pc - codePtr->codeStart), \ @@ -1930,6 +1930,10 @@ TclExecuteByteCode( * Result variable - needed only when going to * checkForCatch or other error handlers; also * used as local in some opcodes. */ +#ifdef TCL_COMPILE_DEBUG + int traceInstructions; /* Whether we are doing instruction-level + * tracing or not. */ +#endif } TAUX = { NULL, NULL, @@ -1987,7 +1991,6 @@ TclExecuteByteCode( int opnd, objc, length, pcAdjustment; Var *varPtr, *arrayPtr; #ifdef TCL_COMPILE_DEBUG - int traceInstructions = (tclTraceExec == 3); char cmdNameBuf[21]; #endif @@ -2033,6 +2036,9 @@ TclExecuteByteCode( */ nonRecursiveCallStart: +#ifdef TCL_COMPILE_DEBUG + TAUX.traceInstructions = (tclTraceExec == 3); +#endif codePtr->refCount++; BP = (BottomData *) GrowEvaluationStack(iPtr->execEnvPtr, sizeof(BottomData) + codePtr->maxExceptDepth + sizeof(CmdFrame) @@ -2177,7 +2183,7 @@ TclExecuteByteCode( ValidatePcAndStackTop(codePtr, pc, CURR_DEPTH, 0, /*checkStack*/ auxObjList == NULL); - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, "%2d: %2d ", iPtr->numLevels, (int) CURR_DEPTH); TclPrintInstruction(codePtr, pc); fflush(stdout); @@ -2287,7 +2293,7 @@ TclExecuteByteCode( #ifdef TCL_COMPILE_DEBUG TRACE_WITH_OBJ(("=> return code=%d, result=", TRESULT), iPtr->objResultPtr); - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, "\n"); } #endif @@ -2773,7 +2779,7 @@ TclExecuteByteCode( if (tclTraceExec >= 2) { int i; - if (traceInstructions) { + if (TAUX.traceInstructions) { strncpy(cmdNameBuf, TclGetString(objv[0]), 20); TRACE(("%u => call ", objc)); } else { @@ -2853,7 +2859,7 @@ TclExecuteByteCode( */ #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " Tailcall request received\n"); } #endif /* TCL_COMPILE_DEBUG */ @@ -6359,7 +6365,7 @@ TclExecuteByteCode( NEXT_INST_F(0, 0, 0); } #if TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { objPtr = Tcl_GetObjResult(interp); if ((TRESULT != TCL_ERROR) && (TRESULT != TCL_RETURN)) { TRACE_APPEND(("OTHER RETURN CODE %d, result= \"%s\"\n ", @@ -6447,7 +6453,7 @@ TclExecuteByteCode( if (Tcl_Canceled(interp, 0) == TCL_ERROR) { #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " ... cancel with unwind, returning %s\n", StringForResultCode(TRESULT)); } @@ -6463,7 +6469,7 @@ TclExecuteByteCode( if (TclLimitExceeded(iPtr->limit)) { #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " ... limit exceeded, returning %s\n", StringForResultCode(TRESULT)); } @@ -6472,7 +6478,7 @@ TclExecuteByteCode( } if (catchTop == initCatchTop) { #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " ... no enclosing catch, returning %s\n", StringForResultCode(TRESULT)); } @@ -6488,7 +6494,7 @@ TclExecuteByteCode( */ #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " ... no enclosing catch, returning %s\n", StringForResultCode(TRESULT)); } @@ -6510,7 +6516,7 @@ TclExecuteByteCode( TclDecrRefCount(valuePtr); } #ifdef TCL_COMPILE_DEBUG - if (traceInstructions) { + if (TAUX.traceInstructions) { fprintf(stdout, " ... found catch at %d, catchTop=%d, " "unwound to %ld, new pc %u\n", rangePtr->codeOffset, (int) (catchTop - initCatchTop - 1), -- cgit v0.12