With:
.sub foo .include "interpinfo.pasm" $P0 = interpinfo .INTERPINFO_CURRENT_SUB $S0 = $P0 # "foo"
we can now extract the current subroutine's name or print it like in the tests t/pmc/sub_{74,75}.pasm. I've implemted the get_string() vtable for Sub PMCs - could be get_repr() too, dunno.
So what next:
$P0 = interpinfo .INTERPINFO_CALL_CHAIN
could construct an array-ish PMC of all subs by climbing up continuations. $P0[0] = current Sub, $P0[1] = caller ...
And e.g.
$P1 = $P0[1] # caller Sub PMC opcode_offs = $P1."get_opcode_offs"() source_line_nr = $P1."get_source_line_nr"()
or something like that. That would need some book-keeping of the current PC at least for function calls. If the traceback should be exact for all exceptions, we'd need much more updating of the current PC, which is currently done only in the slow run core for profiling mainly.
Comments welcome, leo