The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::Optrace - Traces opcodes which are running now

VERSION

This document describes Devel::Optrace version 0.01.

SYNOPSIS

        use Devel::Optrace;
        Devel::Optrace->set(-all => 1); # enables -trace, -stack and -runops
        # ...
        Devel::Optrace->set(-all => 0); # disables -trace, stack and -runops

        # or command line:
        # $ perl -MDevel::Optrace=-all -e '...'  # normal way
        # $ perl -d:Optrace -e '...'             # shortcut

DESCRIPTION

Devel::Optrace is an opcode debugger which traces opcodes and stacks.

There are three trace options:

-trace

Traces opcodes like perl's -Dt, reporting "$opcode @op_private @op_flags" or "$opcode(@op_data) @op_private @op_flags".

-stack

Dumps the perl stack (PL_stack) like perl's -Ds.

-runops

Traces runops levels.

EXAMPLES

perl -d:Optrace -e 'print qq{Hello, @_ world!\n}':

        Entering RUNOPS (-e:0)
        ()
        enter
         ()
         nextstate(main -e:1) VOID
         ()
         pushmark SCALAR
         ()
         const("Hello, ") SCALAR
         ("Hello, ")
         pushmark SCALAR
         ("Hello, ")
         gvsv($") SCALAR
         ("Hello, "," ")
         gv(*_) SCALAR
         ("Hello, "," ",*_)
         rv2av LIST KIDS
         ("Hello, "," ")
         join SCALAR KIDS
         ("Hello, ","")
         concat SCALAR KIDS
         ("Hello, ")
         const(" world!\n") SCALAR
         ("Hello, "," world!\n")
         concat SCALAR KIDS STACKED
         ("Hello,  world!\n")
         print VOID KIDS
         (YES)
         leave VOID KIDS PARENS
        ()
        Leaving RUNOPS (-e:0)

DEPENDENCIES

Perl 5.8.1 or later, and a C compiler.

BUGS

No bugs have been reported.

Please report any bugs or feature requests to the author.

SEE ALSO

perlrun.

B::Concise.

AUTHOR

Goro Fuji (gfx) <gfuji(at)cpan.org>.

LICENSE AND COPYRIGHT

Copyright (c) 2009, Goro Fuji (gfx). Some rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.