Devel::Optrace - Traces opcodes which are running now
This document describes Devel::Optrace version 0.05.
use Devel::Optrace; Devel::Optrace->enable(); # enables -trace, -stack and -runops # ... Devel::Optrace->disable(); # disables -trace, -stack and -runops # or command line: # $ perl -MDevel::Optrace=-all -e '...' # normal way # $ perl -d:Optrace -e '...' # shortcut
Devel::Optrace is an opcode debugger which traces opcodes and stacks.
There are several trace options:
Traces opcodes like perl's -Dt, reporting "$opcode @op_private @op_flags" or "$opcode(@op_data) @op_private @op_flags".
-Dt
"$opcode @op_private @op_flags"
"$opcode(@op_data) @op_private @op_flags"
The indent level indicates the depth of the context stacks.
Dumps the perl stack (PL_stack) like perl's -Ds.
PL_stack
-Ds
Traces runops levels with the current stack info type (MAIN, OVERLOAD, DESTROY, etc.).
runops
Sets -trace, -stack and -runops on/off.
-trace
-stack
-runops
Counts and reports opcodes executed.
Disable the peephole optimizer.
perl -d:Optrace -e 'print qq{Hello, @ARGV world!\n}' Perl:
perl -d:Optrace -e 'print qq{Hello, @ARGV world!\n}' Perl
Entering RUNOPS MAIN (-e:0) () enter () nextstate(main -e:1) VOID () pushmark SCALAR () const("Hello, ") SCALAR ("Hello, ") pushmark SCALAR ("Hello, ") gvsv($") SCALAR ("Hello, "," ") gv(*ARGV) SCALAR ("Hello, "," ",*ARGV) rv2av LIST KIDS ("Hello, "," ","Perl") join SCALAR KIDS ("Hello, ","Perl") concat SCALAR KIDS ("Hello, Perl") const(" world!\n") SCALAR ("Hello, Perl"," world!\n") concat SCALAR KIDS STACKED ("Hello, Perl world!\n") print VOID KIDS (YES) leave VOID KIDS PARENS () Leaving RUNOPS MAIN (-e:0)
This reveals that the perl code print qq{Hello, @ARGV world!\n} is interpreted as print qq{Hello, } . join($", @ARGV) . qq{ world!\n}.
print qq{Hello, @ARGV world!\n}
print qq{Hello, } . join($", @ARGV) . qq{ world!\n}
Perl 5.8.1 or later, and a C compiler.
No bugs have been reported.
Please report any bugs or feature requests to the author.
perlrun.
B::Concise.
Goro Fuji (gfx) <gfuji(at)cpan.org>.
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.
To install Devel::Optrace, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::Optrace
CPAN shell
perl -MCPAN -e shell install Devel::Optrace
For more information on module installation, please visit the detailed CPAN module installation guide.