Tcl Source Code

View Ticket
Login
Ticket UUID: 1201035
Title: crash in TclCheckInterpTraces
Type: Bug Version: obsolete: 8.5a3
Submitter: msofer Created on: 2005-05-12 22:17:41
Subsystem: 46. Traces Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2005-06-22 01:33:09
Resolution: Fixed Closed By: dgp
    Closed on: 2005-06-21 18:33:09
Description:
bschofield reports on clt that the script 'crash'
(attached) crashes tcl8.4.9. I verified the crash in
both HEAD and 8.4-branch.

The immediate cause of the crash is that tracePtr is
NULL on line 1492 in TclCheckInterpTraces. The stack
trace is

#0  0x0808cdcf in TclCheckInterpTraces
(interp=0x81432c8, command=0x8183bd5 "set x 1\n",
numChars=7,
    cmdPtr=0x81484f0, code=0, traceFlags=1, objc=3,
objv=0x8144260) at ../generic/tclTrace.c:1492
#1  0x080b9d9b in TclEvalObjvInternal
(interp=0x81432c8, objc=3, objv=0x8144260,
    command=0x8183bd5 "set x 1\n", length=7, flags=0)
at ../generic/tclBasic.c:3339
#2  0x080f7001 in TclExecuteByteCode (interp=0x81432c8,
codePtr=0x8185d48) at ../generic/tclExecute.c:1721
#3  0x080f5758 in TclCompEvalObj (interp=0x81432c8,
objPtr=0x8167440) at ../generic/tclExecute.c:1030
#4  0x08081ee9 in TclObjInterpProc
(clientData=0x8161ff8, interp=0x81432c8, objc=1,
objv=0xbfffee50)
    at ../generic/tclProc.c:1328
User Comments: dgp added on 2005-06-22 01:33:09:
Logged In: YES 
user_id=80530

fix ported to HEAD

dgp added on 2005-06-21 21:46:10:
Logged In: YES 
user_id=80530


patch committed for 8.4.11

report still open to deal with
it in the HEAD.

dgp added on 2005-06-21 10:16:11:

File Added - 139168: 1201035.patch

dgp added on 2005-06-21 10:16:10:
Logged In: YES 
user_id=80530


Attached patch (for 8.4.11) appears to
stop the crashes.  Please test.

dgp added on 2005-06-21 09:03:11:
Logged In: YES 
user_id=80530


The deletion of "interp" traces
lacks the walk of the activeTrace
list that's done for command and
variable traces.  That's at least related,
and possibly the cause of this.

dgp added on 2005-05-17 04:36:01:
Logged In: YES 
user_id=80530


Note that adding a trace
during an enterstep or
leavestep callback can't
impace the current command
evaluation, but (inconsistently?)
removing a trace takes effect
immediately:

% proc foo {} {
    lappend ::x foo
    lappend ::x foo
}
% proc bar args {   
    lappend ::x bar
trace remove execution foo enterstep bar
trace add execution foo enterstep bar
}
% trace add execution foo enterstep bar
% foo
bar foo foo

dgp added on 2005-05-17 02:59:15:
Logged In: YES 
user_id=80530


Simpler script that make same crash:

proc x {} {
    puts ACTION
}
proc es {args} {
    puts $args
    trc remove
    trc add
    puts done
}
proc trc {m} {
    trace $m execution ::x leavestep es
    trace $m execution ::x enterstep es
}
trc add
x

Reverse the two commands in the [trc] body,
and there's no crash, but the trace result
is incorrect.

msofer added on 2005-05-13 05:17:46:

File Added - 134265: crash

Attachments: