Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Identifying a location with finer granularity than a line number (-MO=)

by rockyb (Beadle)
on Aug 15, 2012 at 04:27 UTC ( #987497=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Identifying a location with finer granularity than a line number (-MO=)
in thread Identifying a location with finer granularity than a line number

Count me in on liking to pursue that possibility too.

The challenges, as I understand it, are that currently B::Terse and B::Concise parse the source text a new rather than have the ability to work on an in place node structure. So the addresses might not be the same, even if the overall tree layout would be the same. Waving my hands, there might be a way to correlate the two sets of addresses used. But that bleeds into the other problem: being able to get at the equivalent of a PC and the opnodes of the tree that is currently live.

The aforementioned debugger currently does have a plugin to add a dissassemble command which attempts to allow you to see dissassembly of the code around where you are stopped if that's what you want.

However I have found that the B::Concise code may need improvement when using it more than once in a session with different format styles. Probably not a big issue since I don't think it a likely thing to do after initially settling on a dump style when new to B::Concise. But the frailty is there.


Comment on Re^4: Identifying a location with finer granularity than a line number (-MO=)
Re^5: Identifying a location with finer granularity than a line number (B::Concise)
by tye (Cardinal) on Aug 15, 2012 at 06:11 UTC
    currently B::Terse and B::Concise parse the source text a new rather than have the ability to work on an in place node structure

    I'm pretty sure you are precisely wrong on that point.

    The B::Concise man page shows how to call the compile() method which does not take Perl source code (despite what the name "compile" might imply) but only a list of subroutine names or CODE refs. So it seems pretty clear that the module walks the opnode tree of your existing interpreter instance for Perl code that you have already compiled. Looking at the source code of B::Concise and B confirms this.

    - tye        

      Ah, yes. Ok. So now how can I get a CODE ref from the call stack of a running Perl program?

      Independent of this particular problem, it's something I'd want to be able to do. I can't remember the details now but I recall needing a CODE ref (as opposed to a in "context") in conjunction with the module Scope::Upper

        For the record, recent versions — 0.08 and later — of Devel::Callsite gives the OP address that you are stopped at or of a caller in the call stack. (The address of the OP is a child of the COP instruction, but this isn't an important distinction.)

Re^5: Identifying a location with finer granularity than a line number (-MO=)
by bulk88 (Priest) on Aug 15, 2012 at 13:52 UTC
    Your on the right idea, you will have to show the opcode disassembly if you want better resolution than a line number.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987497]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-26 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls