in reply to Re^9: Beyond Inside-Out (no)
in thread Beyond Inside-Out
AFAIK caller looks up subroutine names via the coderef of the stack frame in question. While many entries in the symbol table may point to the same typeglob, the xgv_name field of that typeglob's coderef entry ever only holds one name, which is returned by caller.
<update>
Erm, no. Poking around with gdb (Perl_pp_caller, file pp_ctl.c)...
(gdb) run -e 'sub foo { caller(0) }; *bar = *foo; my @l=bar()' ... Breakpoint 2, Perl_pp_caller (my_perl=0x804c008) at pp_ctl.c:1567 1567 if (MAXARG) ... (stepping over 'register I32 cxix = dopoptosub(cxstack_ix);') ... (gdb) print ccstack[1].cx_u.cx_blk.blk_u.blku_sub.cv.sv_any.xcv_gv.sv_ +any[0] $7 = {xnv_nv = 0, xpv_cur = 0, xpv_len = 0, xiv_u = {xivu_iv = 0, xivu +_uv = 0, xivu_p1 = 0x0}, xmg_magic = 0x80540ec, xmg_stash = 0x0, xgv_gp = 0 +x80540b4, xgv_name = 0x805410c "foo", xgv_namelen = 3, xgv_stash = 0x804cb4c, xgv_flags = 10 '\n'} (gdb) print ccstack[1].cx_u.cx_blk.blk_u.blku_sub.cv.sv_any.xcv_gv.sv_ +any[1] $8 = {xnv_nv = 0, xpv_cur = 0, xpv_len = 0, xiv_u = {xivu_iv = 0, xivu +_uv = 0, xivu_p1 = 0x0}, xmg_magic = 0x806f244, xmg_stash = 0x0, xgv_gp = 0 +x80540b4, xgv_name = 0x806f264 "bar", xgv_namelen = 3, xgv_stash = 0x804cb4c, xgv_flags = 10 '\n'}
</update>
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|