From: SourceForge.net <no...@so...> - 2010-09-19 21:02:29
|
Bugs item #3059758, was opened at 2010-09-05 12:14 Message generated for change (Comment added) made by ferrieux You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3059758&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 47. Bytecode Compiler Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alexandre Ferrieux (ferrieux) Assigned to: miguel sofer (msofer) Summary: tclTraceExec==3 : wrong pc+INST on uncaught error return Initial Comment: When tracing instructions (tclTraceExec==3), returns from procedure calls typically look like: ... no enclosing catch, returning TCL_OK LEVEL: DEPTH (PC) INST args => ... after "PROCNAME": TCL_OK, result="1" where PC and INST/args are the position and instruction to be executed just after the return. However, when the return code is not TCL_OK, the PC is off by one, and is the last byte of the previous instruction (typically invokeXXX), and consequently the INST is random (possibly an immediate operand interpreted as an opcode): ... no enclosing catch, returning TCL_ERROR LEVEL: DEPTH (WRONG PC) WRONG INST => TCL_ERROR, result= "..." Of course this is a very tiny issue, but tracing instructions accurately is key to understanding the delicate operation of TEBC, and this microbug has been annoying in the course of the investigation of Patch 2995655. The fix/insight could help both. ---------------------------------------------------------------------- >Comment By: Alexandre Ferrieux (ferrieux) Date: 2010-09-19 23:02 Message: Attaching a patch that at least brings back a valid pc and inst, though it is the instruction _following_ the one which is erroring. Though it is not entirely acceptable for the current purpose, this patch uses a new local in TEBC, pcBeg, that is also needed for 2995655. Miguel, please review :} ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2010-09-19 22:53 Message: Attaching example: traccexec.tcl, and generated output, out.txt. The following line from the output has an invalid pc and instruction: 1: 3 (7) pop => TCL_ERROR, result= "Yo" since offset 7 is not the beginning of an instruction: Command 1: "B x x" (0) push1 0 # "B" (2) push1 1 # "x" (4) push1 1 # "x" (6) invokeStk1 3 (8) done ---------------------------------------------------------------------- Comment By: Alexandre Ferrieux (ferrieux) Date: 2010-09-06 01:10 Message: The 'pc--' after the nonRecursiveCallReturn: label is the reason. I know it is necessary, so that the pc goes back into the range of the offending instruction, so that TIP 280 info can be recomputed from it, but subsequently a stronger contract is expected: namely that *pc be the inst itself: processExceptionReturn: #if TCL_COMPILE_DEBUG switch (*pc) { ... So, the conflict must be resolved, either by giving up the pretty printing of the offending inst, or by using the pc-indexing data in TIP 280 to crawl back to the beginning of the inst (conditionally on TCL_COMPILE_DEBUG). ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=3059758&group_id=10894 |