On Thu, May 03, 2007 at 10:50:07AM -0700, Artur Bergman wrote:
On May 3, 2007, at 4:15 AM, Tim Bunce wrote:
Umm. PL_copline looks like it's compile-time only.
And CopLINE(PL_curop) gives the line number of the current statement,
not the first statement of the current block/scope.
With a bit of digging the nearest I've seen (or guessed at) so far is
CopLINE(cxstack[cxstack_ix].blk_oldcop) which I think will give me the
line number of the start of the current subroutine, eval, or loop.
Right?
Loop level would be handy but I'd still like to get down to block/
scope level.
Ah, I missunderstood, you want to find the start of the perl level
scope that access your XS?
Yes.
loop is a block/scope :) but I guess you can just walk down the
cxstack until you find the type you want
CxTYPE == CXt_SUB and CXt_BLOCK
Ah, yes, I see CXt_BLOCK corresponds with pp_enter which corresponds
with entering a block/scope. Great. Obvious when I see it now.
Thanks Artur.
Tim.
p.s. This is in relation to a background project of mine to extend
Devel::FastProf to support gathering profile data per-block. I'm not
sure it'll happen, but I am sure it would be interesting and useful.