Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2005-06-22
01:33 • Closed ticket [1201035fff]: crash in TclCheckInterpTraces plus 7 other chang... artifact: fe12d8929c user: dgp
2005-06-21
21:46 • Ticket [1201035fff]: 4 changes artifact: 64594c6a2a user: dgp
10:16 • Ticket [1201035fff]: 4 changes artifact: a633d6b143 user: dgp
10:16 • Add attachment 1201035.patch to ticket [1201035fff] artifact: 0c104a47f2 user: dgp
10:16 • Ticket [1201035fff] crash in TclCheckInterpTraces status still Open with 4 o... artifact: 6bf97ae4e3 user: dgp
09:03 • Ticket [1201035fff]: 4 changes artifact: bd9f509a68 user: dgp
2005-05-17
04:36 • Ticket [1201035fff]: 4 changes artifact: c6058770ce user: dgp
02:59 • Ticket [1201035fff]: 4 changes artifact: 3f2285fde8 user: dgp
2005-05-13
05:17 • Ticket [1201035fff]: 4 changes artifact: 2aa702dc7c user: msofer
05:17 • Add attachment crash to ticket [1201035fff] artifact: 72d3919418 user: msofer
2005-05-12
22:17 • New ticket [1201035fff] crash in TclCheckInterpTraces. artifact: d277b0e7a1 user: msofer

crash in TclCheckInterpTraces

Closed / Fixed1201035fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 21 years ago
Descriptionplain2005-05-12 22:17:41
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
msoferplain2005-05-13 05:17:46
File Added - 134265: crash
dgpplain2005-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.
dgpplain2005-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
dgpplain2005-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.
dgpplain2005-06-21 10:16:10
Logged In: YES 
user_id=80530


Attached patch (for 8.4.11) appears to
stop the crashes.  Please test.
dgpplain2005-06-21 10:16:11
File Added - 139168: 1201035.patch
dgpplain2005-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.
dgpplain2005-06-22 01:33:09
Logged In: YES 
user_id=80530

fix ported to HEAD
Log in (anonymous is fine) to add a comment.

Attachments: