Perl Disassembly plugin for Devel::Trepan via B::Concise


This adds a disassemble command to the Devel::Trepan debugger.


disassemble [options] [subroutine|package-name ...]


    [-]-from <line-number>
    [-]-to <line-number>

Disassembles the Perl interpreter OP tree using B::Concise.

Flags -from and -to respectively exclude lines less than or greater that the supplied line number. If no -to value is given and a subroutine or package is not given then the -to value is taken from the "listsize" value as a count, and the -from value is the current line.

Use set max list or show max list to see or set the number of lines to list.

-no-highlight will turn off syntax highlighting. -highlight=dark sets for a dark background, light for a light background and plain is the same as -no-highlight.

Other flags are are the corresponding B::Concise flags and that should be consulted for their meaning.


  $ -e 1

  (trepanpl): dissassemble
  Package Main
    main program:
  =>  LISTOP (0xa0dd208)
        op_next         0
        op_sibling      0
        op_ppaddr       PL_ppaddr[OP_LEAVE]
        op_type         185
        op_flags        0001101: parenthesized, want kids, want void
        op_private      64
        op_first        0xa0e6f60
        op_last         0xa0e7298
    OP (0xa0e6f60)
        op_next         0xa0dd228
        op_sibling      0xa0dd228
        op_ppaddr       PL_ppaddr[OP_ENTER]
        op_type         184
        op_flags        0000000
        op_private      0
    # 1: 1
    COP (0xa0dd228)
        op_next         0xa0dd208
        op_sibling      0xa0e7298
        op_ppaddr       PL_ppaddr[OP_DBSTATE]
        op_type         182
        op_flags        0000001: want void
        op_private      0       256
    OP (0xa0e7298)
        op_next         0xa0dd208
        op_sibling      0
        op_ppaddr       PL_ppaddr[OP_NULL]
        op_type         0
        op_flags        0000001: want void
        op_private      0

Above, the => indicates the next instruction to run.

By default disasm is an alias for disassemble. Here is the -tree option; --tree is okay too.

   (trepanpl): disasm -tree

    main program:
              |-# 1:  1

Functions can be given:

   (trepanpl): disasm -basic File::Basename::basename

    UNOP (0x8ad1d00)
        op_next         0
        op_sibling      0
        op_ppaddr       PL_ppaddr[OP_LEAVESUB]
        op_type         174

Finally, you can limit the range of output using -from and/or -to:

   (trepanpl): disasm -from 227 -to 236 -basic File::Basename::basename

See also:

list, and deparse, set highlight, set max list, and show max list.


Rocky Bernstein


Copyright (C) 2012, 2015 Rocky Bernstein <>

This program is distributed WITHOUT ANY WARRANTY, including but not limited to the implied warranties of merchantability or fitness for a particular purpose.

The program is free software. You may distribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (either version 2 or any later version) and the Perl Artistic License as published by O'Reilly Media, Inc. Please open the files named gpl-2.0.txt and Artistic for a copy of these licenses.