Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Getting a B::OP from an address?

by rockyb (Beadle)
on May 10, 2014 at 13:28 UTC ( #1085671=perlquestion: print w/ replies, xml ) Need Help??
rockyb has asked for the wisdom of the Perl Monks concerning the following question:

In the debugger Devel::Trepan, there is the ability to show B:OP addresses. There is an optional plugin which allows one to disassemble Perl subroutines and packages. But what I'd like to do is to be able to disassemble a more limited region around the OP address. So how can I do that?

I know about Devel::Pointer, but I can't get that to work here:

(trepanpl): disasm Devel::Trepan::Options::whence_file ... OP (0x9961848) op_next 0x9961828 op_sibling 0 op_ppaddr PL_ppaddr[OP_PADSV] op_type 9 op_flags 0000000 op_private 0 (trepanpl): sprintf "%d", 0x9961848 $DB::D[7] = 160831560 (trepanpl): $c = deref(160831560) ** Bizarre copy of UNKNOWN in scalar assignment $DB::D[8] = <undef> Program received signal SEGV. Segmentation fault (core dumped)

Thoughts or suggestions?

Thanks.

Comment on Getting a B::OP from an address?
Download Code
Replies are listed 'Best First'.
Re: Getting a B::OP from an address
by roboticus (Chancellor) on May 10, 2014 at 13:52 UTC

    rockyb:

    The deref function of Devel::Pointer is for handling perl values, not random chunks of memory. And an opcode isn't a standard perl value. I think you'll probably be better served digging through the B::* modules. If it were me, I'd start with B::Utils from which you can navigate the opcode tree(s) in a program.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (13)
As of 2015-07-28 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls