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.