Cool. Can I co-opt this so I can get tcl-like backtraces when running tcl code? If so, how? =-)
Jens Rieks wrote:
Hi,
the new backtrace code is in. If a parrot program aborts due to an error, a backtrace is shown. Examples:
---- Null PMC access in invoke() current instr.: 'd' pc 149 (t/op/debuginfo_4.imc:24) called from Sub 'c' pc 116 (t/op/debuginfo_4.imc:18) called from Sub 'b' pc 85 (t/op/debuginfo_4.imc:13) called from Sub 'a' pc 54 (t/op/debuginfo_4.imc:8) called from Sub 'main' pc 23 (t/op/debuginfo_4.imc:3)
---- Null PMC access in invoke() current instr.: 'rec' pc 111 (t/op/debuginfo_8.imc:12) called from Sub 'rec' pc 71 (t/op/debuginfo_8.imc:8) ... call repeated 90 times called from Sub 'main' pc 24 (t/op/debuginfo_8.imc:2)
---- maximum recursion depth exceeded current instr.: 'main' pc 21 (t/op/debuginfo_7.imc:2) called from Sub 'main' pc 21 (t/op/debuginfo_7.imc:2) ... call repeated 999 times
---- Lexical 'nosuchlex' not found current instr.: 'Test2 :: foo' pc 35 (t/op/debuginfo_6.imc:10) called from Sub 'Test2 :: main' pc 25 (t/op/debuginfo_6.imc:5)
If you use "debug 1", a backtrace is shown even for exceptions cought with an exception handler.
jens
PS: filenames are still wrong for included files, because only one filename is stored per bytecode segment (AFAIK). Cf. src/sub.c:615ff