|
2015-07-07
| ||
| 08:33 | • Ticket [a0ece9d6d4] execution trace on source command crashes when executing clo... artifact: c4e2ced153 user: anonymous | |
|
2015-07-05
| ||
| 16:53 | • Closed ticket [a0ece9d6d4]. artifact: 916c071c3c user: dgp | |
| 16:52 | [a0ece9d6d4] The cmd field of a CmdFrame when non-NULL must point within the string of the correspon... check-in: 032f16915b user: dgp tags: trunk | |
|
2015-07-02
| ||
| 19:49 | • Ticket [a0ece9d6d4] execution trace on source command crashes when executing clo... artifact: 36da907629 user: dgp | |
| 16:08 | • Ticket [a0ece9d6d4]: 3 changes artifact: 9e70f3fa59 user: dgp | |
| 13:41 | • Ticket [a0ece9d6d4]: 5 changes artifact: 48d785f7d7 user: dgp | |
| 10:47 | • Ticket [a0ece9d6d4]: 3 changes artifact: cff2207ac5 user: anonymous | |
| 08:57 | • Ticket [a0ece9d6d4]: 3 changes artifact: 2a1d6c7a50 user: anonymous | |
| 07:06 | • Ticket [a0ece9d6d4]: 4 changes artifact: 15f27e464a user: oehhar | |
|
2015-07-01
| ||
| 14:07 | • New ticket [a0ece9d6d4]. artifact: 55a637a037 user: anonymous | |
execution trace on source command crashes when executing clock scan
Closed / Fixeda0ece9d6d449ed4aab0262891caf457087e50709Created 11 years agoUpdated 11 years ago
Descriptionplain2015-07-01 14:07:44
On Windows 7, I'm trying to debug scripts using execution traces on the source command. This works well to a great extent, but when the script executes the 'clock scan' command Tcl crashes.
Here's the minimalistic code that shows it:
clockscan.tcl:
clock scan 1980-01-01
In tclsh:
% proc enterStep args { puts "enter" }
% proc leaveStep args { puts "leave" }
% trace add execution source enterstep enterStep
% trace add execution source leavestep leaveStep
% source clockscan.tcl
<many enter/leave msgs>
Crash!
This happens in all of the following:
- tclsh and wish of ActiveState Tcl 8.6.1.0 installation (threaded)
- tclsh and wish built from Tcl 8.6.4 sources, both debug and release (threaded)
Stacktrace from my own debug build:
msvcr120d.dll!0f5731ca() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr120d.dll]
> tcl86tg.dll!TclNRRunCallbacks(Tcl_Interp * interp, int result, NRE_callback * rootPtr) Line 4392 C
tcl86tg.dll!Tcl_EvalObjv(Tcl_Interp * interp, int objc, Tcl_Obj * const * objv, int flags) Line 4123 C
tcl86tg.dll!TclEvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags, int line, int * clNextOuter, const char * outerScript) Line 5262 C
tcl86tg.dll!TclSubstTokens(Tcl_Interp * interp, Tcl_Token * tokenPtr, int count, int * tokensLeftPtr, int line, int * clNextOuter, const char * outerScript) Line 2277 C
tcl86tg.dll!TclEvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags, int line, int * clNextOuter, const char * outerScript) Line 5150 C
tcl86tg.dll!Tcl_FSEvalFileEx(Tcl_Interp * interp, Tcl_Obj * pathPtr, const char * encodingName) Line 1815 C
tcl86tg.dll!Tcl_FSEvalFile(Tcl_Interp * interp, Tcl_Obj * pathPtr) Line 1711 C
tcl86tg.dll!Tcl_EvalFile(Tcl_Interp * interp, const char * fileName) Line 427 C
If I record the frame info in the enterStep then I see that it stops in clock.tcl at line 1391 (in tcl::clock::FreeScan).
Note that for now I have a workaround that renames clock and executes it in a slave interpreter.
Referenced by1
032f16915b[a0ece9d6d4] The cmd field of a CmdFrame when non-NULL must point within the string of the corresponding codePtr->source. check-in2015-07-05 16:52:27
oehharwiki2015-07-02 07:06:49
I have tried you code with the current trunk (2015-07-01) and it did not crash:
wish8.6 ... leave 315529200 (bin) 7 %
clock package is pure TCL, so it is an issue in the interpreter, which might already be fixed.
Could you verify that ?
Thank you, Harald
anonymousplain2015-07-02 08:57:11
Thanks for the prompt reply. I have downloaded the .zip from GitHub and built it. The original example I provided works now. That's great.
However, I still get a crash if I change the enter proc code to this:
% proc enter args { puts "[info frame [expr [info frame] - 2]]" }
It panics with an error "LocSearch failure".
Stack trace:
> tcl86tg.dll!Tcl_PanicVA(const char * format, char * argList) Line 115 C
tcl86tg.dll!Tcl_Panic(const char * format, ...) Line 153 C
tcl86tg.dll!TclGetSrcInfoForPc(CmdFrame * cfPtr) Line 9957 C
tcl86tg.dll!TclInfoFrame(Tcl_Interp * interp, CmdFrame * framePtr) Line 1341 C
tcl86tg.dll!InfoFrameCmd(void * dummy, Tcl_Interp * interp, int objc, Tcl_Obj * const * objv) Line 1228 C
tcl86tg.dll!Dispatch(void * * data, Tcl_Interp * interp, int result) Line 4360 C
tcl86tg.dll!TclNRRunCallbacks(Tcl_Interp * interp, int result, NRE_callback * rootPtr) Line 4393 C
tcl86tg.dll!Tcl_EvalObjv(Tcl_Interp * interp, int objc, Tcl_Obj * const * objv, int flags) Line 4123 C
tcl86tg.dll!TclEvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags, int line, int * clNextOuter, const char * outerScript) Line 5263 C
tcl86tg.dll!Tcl_EvalEx(Tcl_Interp * interp, const char * script, int numBytes, int flags) Line 4927 C
tcl86tg.dll!Tcl_Eval(Tcl_Interp * interp, const char * script) Line 5856 C
tcl86tg.dll!TraceExecutionProc(void * clientData, Tcl_Interp * interp, int level, const char * command, Tcl_Command_ * cmdInfo, int objc, Tcl_Obj * const * objv) Line 1892 C
tcl86tg.dll!TclCheckInterpTraces(Tcl_Interp * interp, const char * command, int numChars, Command * cmdPtr, int code, int traceFlags, int objc, Tcl_Obj * const * objv) Line 1614 C
tcl86tg.dll!TEOV_RunEnterTraces(Tcl_Interp * interp, Command * * cmdPtrPtr, Tcl_Obj * commandPtr, int objc, Tcl_Obj * const * objv) Line 4717 C
tcl86tg.dll!EvalObjvCore(void * * data, Tcl_Interp * interp, int result) Line 4271 C
tcl86tg.dll!TclNRRunCallbacks(Tcl_Interp * interp, int result, NRE_callback * rootPtr) Line 4393 C
tcl86tg.dll!TclEvalObjEx(Tcl_Interp * interp, Tcl_Obj * objPtr, int flags, const CmdFrame * invoker, int word) Line 5959 C
tcl86tg.dll!Tcl_EvalObjEx(Tcl_Interp * interp, Tcl_Obj * objPtr, int flags) Line 5940 C
tcl86tg.dll!Tcl_RecordAndEvalObj(Tcl_Interp * interp, Tcl_Obj * cmdPtr, int flags) Line 190 C
tcl86tg.dll!Tcl_MainExW(int argc, unsigned short * * argv, int (Tcl_Interp *) * appInitProc, Tcl_Interp * interp) Line 535 C
tclsh86tg.exe!wmain(int argc, unsigned short * * argv) Line 129 C
tclsh86tg.exe!__tmainCRTStartup() Line 623 C
tclsh86tg.exe!wmainCRTStartup() Line 466 C
kernel32.dll!7737337a() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!77b292e2() Unknown
ntdll.dll!77b292b5() Unknown
Could you try to reproduce this?
TIA,
Hans
anonymousplain2015-07-02 10:47:15
Some additional info: if I 'catch' the puts statement the crash disappears:
% proc enter args { catch { puts "[info frame [expr [info frame -2]]"} }
% source clockscan.tcl
...
Works fine in the current trunk. But still crashes in the other version where I found the original problem.
dgpplain2015-07-02 13:41:32
[source] is not essential. Simplified demo:
proc e args {info frame [expr [info frame] - 2]}
proc demo {} {clock scan 1980-01-01}
trace add execution demo enterstep e
demo
dgpplain2015-07-02 16:08:49
Current problems originate with: http://core.tcl.tk/tcl/info/2f5ee8efad801
dgpplain2015-07-02 19:49:42
Simpler still:
proc demo {} {expr {rand()}}
trace add execution demo enterstep {apply {args {info frame -2}}}
demo
Key is to be tracing the execution of an [expr] function call, and to
request just the right frame.
dgpplain2015-07-05 16:53:14
Fixed with a test on trunk.
anonymousplain2015-07-07 08:33:58
Works for me now. Thank you.
Log in (anonymous is fine) to add a comment.