Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Getting a B::OP from an address?

by rockyb (Scribe)
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?


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


    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.


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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2021-03-08 06:25 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (123 votes). Check out past polls.