B-DeparseTree

 view release on metacpan or  search on metacpan

lib/B/DeparseTree.pod  view on Meta::CPAN

    Child info:
         addr: 0x23066f8, parent: 0x2306670
         op: gvsv
         text: $a

    return $a < 0 ? -$a : $a
           --
    5: ==================================================
    6: ==================================================
    Child info:
         addr: 0x2306738, parent: 0x2306670
         op: gvsv
         text: $a

    return $a < 0 ? -$a : $a
           --
    6: ==================================================
    9: ==================================================
    Child info:
         addr: 0x23d9600, parent: 0x23d9578
         op: nextstate
         text:

    return $a < 0 ? -$a : $a

    9: ==================================================
    10: ==================================================
    Child info:
         addr: 0x23d9660, parent: 0x23d9698
         op: pushmark
         text: return $a < 0 ? -$a : $a

    return $a < 0 ? -$a : $a
    ||||||
    10: ==================================================
    11: ==================================================
    Child info:
         addr: 0x23d9698, parent: 0x23d9578
         op: return
         text: return $a < 0 ? -$a : $a

    return $a < 0 ? -$a : $a
    ------------------------
    11: ==================================================
    12: ==================================================
    Child info:
         addr: 0x23d96e0, parent: 0x23d9698
         op: cond_expr
         text: $a < 0 ? -$a : $a

    return $a < 0 ? -$a : $a
           -----------------
    12: ==================================================
    ....

The subroutine C<extract_node_info> is what produces the text with its underline.

=head2 Description

Perl's L<B::Deparse> but we save abstract tree information and associate
that with Perl text fragments.  These are fragments accessible by OP
address. With this, in Perl you can determine more precisely where you in
a program with granularity finer that at a line number boundary.

Uses for this could be in stack trace routines like L<Carp>. It is used
in the L<deparse |https://metacpan.org/pod/Devel::Trepan::Deparse>
command extension to L<Devel::Trepan>.

=head2 See also:

=over  4

=item *

L<B::Devel::Trepan::Deparse> for a L<Devel::Trepan> plugin that uses this

=item *

L<B::Deparse> for deparsing without keeping tree information around

=item *

L<B::Callsite> for one way to get opcode locations on the call stack

=item *

L<Rewriting B:Deparse and Reintroducing B::DeparseTree and (part 1) |http://blogs.perl.org/users/rockyb/2018/06/introducing-bdeparsetree-and-rewriting-bdeparse-part-1.html> for
more information.

=item *

L<Exact Perl location with B::Deparse (and Devel::Callsite) |http://blogs.perl.org/users/rockyb/2015/11/exact-perl-location-with-bdeparse-and-develcallsite.html> for
older information.

=back



( run in 1.194 second using v1.01-cache-2.11-cpan-364913b4093 )