Tcl Source Code

View Ticket
Login
Ticket UUID: 1743302
Title: [evalstats] audit
Type: Bug Created on: 2007-06-26 02:40:25
Submitter: das Assigned to: dgp
Subsystem: 47. Bytecode Compiler Severity: Minor
Priority: 3 Low Last modified: 2015-05-11 17:29:26
Status: Open Closed by: nobody
Resolution: Fixed Closed on: 2008-09-13 06:09:29
Version: obsolete: 8.5a6
Description:
The recent TclStackAlloc changes appear to have broken the TCL_COMPILE_DEBUG build:

$ ../tcl/unix/configure --enable-symbols=compile
$ make gdb
gdb ./tclsh --command=gdb.run
GNU gdb 6.3.50-20050815 (Apple version gdb-573) (Fri Oct 20 15:50:43 GMT 2006)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.build
This GDB was configured as "i386-apple-darwin"...
Reading symbols for shared libraries .... done

(gdb) r
Starting program: /TclTk/build/tclsh 
Reading symbols for shared libraries . done
Reading symbols for shared libraries ..... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x0a069707 in GrowEvaluationStack (eePtr=0x0, growth=5, move=0) at /TclTk/tcl/generic/tclExecute.c:657
657         ExecStack *esPtr = eePtr->execStackPtr, *oldPtr = NULL;
(gdb) bt
#0  0x0a069707 in GrowEvaluationStack (eePtr=0x0, growth=5, move=0) at /TclTk/tcl/generic/tclExecute.c:657
#1  0x0a0699cb in StackAllocWords (interp=0x13008, numWords=5) at /TclTk/tcl/generic/tclExecute.c:794
#2  0x0a069b4c in TclStackAlloc (interp=0x13008, numBytes=20) at /TclTk/tcl/generic/tclExecute.c:876
#3  0x0a0b54db in TclResetShadowedCmdRefs (interp=0x13008, newCmdPtr=0xb708) at /TclTk/tcl/generic/tclNamesp.c:2659
#4  0x0a0132e1 in Tcl_CreateObjCommand (interp=0x13008, cmdName=0xa1093ec "evalstats", proc=0xa085f24 <EvalStatsCmd>, clientData=0x0, deleteProc=0) at /TclTk/tcl/generic/tclBasic.c:1976
#5  0x0a069320 in InitByteCodeExecution (interp=0x13008) at /TclTk/tcl/generic/tclExecute.c:482
#6  0x0a069488 in TclCreateExecEnv (interp=0x13008) at /TclTk/tcl/generic/tclExecute.c:536
#7  0x0a0115b5 in Tcl_CreateInterp () at /TclTk/tcl/generic/tclBasic.c:473
#8  0x0a0b1a68 in Tcl_Main (argc=1, argv=0xbffff5c8, appInitProc=0x26b7 <Tcl_AppInit>) at /TclTk/tcl/generic/tclMain.c:349
#9  0x000026ac in main (argc=1, argv=0xbffff5c8) at /TclTk/tcl/unix/tclAppInit.c:87
User Comments:
dgp added on 2007-06-26 10:02:45:
Logged In: YES 
user_id=80530
Originator: NO


For safety, I'll add the
fallback checks to include
a check for the case that
iPtr->eePtr == NULL to prevent
crashes like this.

That said, the [evalstats]
command is rather weird and
strangely placed.  It's a command
getting created in an interp
before that interp is fully
initialized.  Stranger still,
it's a command that apparently
gets created in only the first
interp created in the process.
Someone more familiar with this
command, and what it's supposed
to do, should consider what needs
doing for better thread safety,
multi-interp availability, etc.
for this debugging command, and
also whether it really is best
created where it is created.

dgp added on 2007-06-26 10:12:36:
Logged In: YES 
user_id=80530
Originator: NO


crash prevention fix committed.

dropping prio for the remaining
code review issues.

dgp added on 2008-09-15 11:51:33:
not clear whether the code review
mentioned before got done.