Overview
| Artifact ID: | 0f0aba22e7cb7c4ec70ee4965c4d44e2280b5f1a |
|---|---|
| Ticket: | 2995655fffffffffffffffffffffffffffffffff
Report inner contexts in [info errorstack] |
| User & Date: | ferrieux on 2010-05-02 23:24:04 |
Changes
- assignee changed to: "dgp"
- cmimetype changed to: "text/plain"
- comment changed to:
In TIP #348, now accepted and committed, the error stack reports a list of argslists for procedure calls, along with uplevel offsets. However, it has been noted that the deepest argslist, aka the "inner context", ie the bytecode instruction and the arguments it used off the stack before deciding to raise an error, are not reported. This is frustrating, typically when [expr] with a complex expression raises an error like "domain error: argument not in valid range". The attached patch, designed after advice from Miguel, overcomes this limitation by inserting (when possible) at the beginning of the errorstack: INNER {name_of_instruction arg1 arg2 ... argN} for example: % proc f {x y} {expr {log($x)+acos($y)}} % f 1 2 domain error: argument not in valid range % info errorstack INNER {invokeStk1 tcl::mathfunc::acos 2} CALL {f 1 2} A few notes on the implementation: (1) the impact on TEBC is intentionally minimal (gentle arm twisting, Mig ;-): a single line, saving the pc in another local. (2) only those INSTs where the argc is readily computable, generate a nontrivial inner context report. Others are untouched, just like non-TEBC error sites. (3) the 'knowledge base' giving the algorithm for counting the argc is a single switch() block mimicking a tiny part of TEBC, but which can evolve much slower, since the default is to report only the instruction name. Hence no need to 'keep in sync' too tightly. This should free the mind of those who want to innovate in TEBC... (4) at this stage, there's room for optimization, like pre-computing and sharing the instruction-name literals, and also reusing the list storage for the inner context, just like was done for the error stack itself. High prio because it is an extension that has been asked for during the TIP discussion, the TIP is very young, and a milestone release is approaching... - foundin changed to: "None"
- is_private changed to: "0"
- priority changed to: "9 Immediate"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "ferrieux"
- subsystem changed to: "None"
- title changed to: "Report inner contexts in [info errorstack]"
- type changed to: "Patch"