Calling [info frame -2] from inside of class custom method makes Tcl interpreter crash (SegFault) in some specific sutiation on Linux with Tcl 8.5.2 and Itcl 3.4 (at least it's confirmed for this configuration), on Windows with Tcl 8.4 it works correctly.
Here's code to reproduce the problem:
interp create sl
proc hnd {cmd op} {
puts [sl eval {info frame -3}]
}
interp alias sl hnd {} hnd
sl eval {
package require Itcl
trace add execution puts enter hnd
itcl::class A {
public method x {} {puts 1}
}
A n
n x
}
and here's some stack trace (thanks to Christian Nassau):
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2ac93cf0d0c0 (LWP 2944)]
0x00002ac93bd3443e in TclInfoFrame (interp=0x6974f0, framePtr=0x6a15b0)
at /home/cn/src/tcl8.5.2/unix/../generic/tclCmdIL.c:1228
1228 char *procName =
Tcl_GetHashKey(namePtr->tablePtr, namePtr);
(gdb) where
#0 0x00002ac93bd3443e in TclInfoFrame (interp=0x6974f0, framePtr=0x6a15b0)
at /home/cn/src/tcl8.5.2/unix/../generic/tclCmdIL.c:1228
#1 0x00002ac93bd33b43 in InfoFrameCmd (dummy=0x0, interp=0x6974f0,
objc=2, objv=0x6a1a90)
at /home/cn/src/tcl8.5.2/unix/../generic/tclCmdIL.c:1091
#2 0x00002ac93bd23592 in TclEvalObjvInternal (interp=0x6974f0, objc=2,
objv=0x6a1a90, command=0x0,
length=0, flags=524288) at
/home/cn/src/tcl8.5.2/unix/../generic/tclBasic.c:3649
#3 0x00002ac93bd23c2a in Tcl_EvalObjv (interp=0x6974f0, objc=2,
objv=0x6a1a90, flags=524288)
at /home/cn/src/tcl8.5.2/unix/../generic/tclBasic.c:3844
#4 0x00002ac93bdc8557 in NsEnsembleImplementationCmd
(clientData=0x6a6630, interp=0x6974f0, objc=3,
objv=0x6a1a68) at
/home/cn/src/tcl8.5.2/unix/../generic/tclNamesp.c:6217
#5 0x00002aaaaaae4a6b in Itcl_DefaultInfoCmd () from
/home/cn/tcl85/lib/itcl3.4/libitcl3.4.so
#6 0x00002aaaaaaecb5b in HandleEnsemble () from
/home/cn/tcl85/lib/itcl3.4/libitcl3.4.so
#7 0x00002ac93bdc1bd6 in InvokeImportedCmd (clientData=0x723880,
interp=0x6974f0, objc=3, objv=0x6a1a68)
at /home/cn/src/tcl8.5.2/unix/../generic/tclNamesp.c:1889
#8 0x00002ac93bd23592 in TclEvalObjvInternal (interp=0x6974f0, objc=3,
objv=0x6a1a68,
command=0xffffffffffffffff <Address 0xffffffffffffffff out of
bounds>, length=-1, flags=0)
at /home/cn/src/tcl8.5.2/unix/../generic/tclBasic.c:3649
Logged In: YES
user_id=843802
Originator: YES
Eh :( I've pasted script with [info frame -3], which works correctly of course, it crashes only ith frame argument is -2. Sorry for cluttering.