summaryrefslogtreecommitdiff
path: root/ext/Devel/Peek
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>2002-03-02 00:49:58 -0500
committerAbhijit Menon-Sen <ams@wiw.org>2002-03-03 04:40:08 +0000
commit1045810a2eefbb8aa6c05bba7cac36942959fec7 (patch)
tree9b358824ffd7616299037cdd977dcd549b44d3f0 /ext/Devel/Peek
parent9c493e7aec33685418d2252a524219fe91183a99 (diff)
downloadperl-1045810a2eefbb8aa6c05bba7cac36942959fec7.tar.gz
Debugging OPs
Message-Id: <20020302054958.A5511@math.ohio-state.edu> p4raw-link: @14577 on //depot/perl: 0ad5258ff3f3328f321188cbb4fcd6a74b365431 p4raw-id: //depot/perl@14956
Diffstat (limited to 'ext/Devel/Peek')
-rw-r--r--ext/Devel/Peek/Peek.pm27
1 files changed, 27 insertions, 0 deletions
diff --git a/ext/Devel/Peek/Peek.pm b/ext/Devel/Peek/Peek.pm
index ecc44b7ca0..3b4b845be5 100644
--- a/ext/Devel/Peek/Peek.pm
+++ b/ext/Devel/Peek/Peek.pm
@@ -17,6 +17,26 @@ use XSLoader ();
XSLoader::load 'Devel::Peek';
+sub import {
+ my $c = shift;
+ my $ops_rx = qr/^:opd(=[stP]*)?\b/;
+ my @db = grep m/$ops_rx/, @_;
+ @_ = grep !m/$ops_rx/, @_;
+ if (@db) {
+ die "Too many :opd options" if @db > 1;
+ runops_debug(1);
+ my $flags = ($db[0] =~ m/$ops_rx/ and $1);
+ $flags = 'st' unless defined $flags;
+ my $f = 0;
+ $f |= 2 if $flags =~ /s/;
+ $f |= 8 if $flags =~ /t/;
+ $f |= 64 if $flags =~ /P/;
+ $^D |= $f if $f;
+ }
+ unshift @_, $c;
+ goto &Exporter::import;
+}
+
sub DumpWithOP ($;$) {
local($Devel::Peek::dump_ops)=1;
my $depth = @_ > 1 ? $_[1] : 4 ;
@@ -58,6 +78,8 @@ Devel::Peek - A data debugging tool for the XS programmer
DumpArray( 5, $a, $b, ... );
mstat "Point 5";
+ use Devel::Peek ':opd=st';
+
=head1 DESCRIPTION
Devel::Peek contains functions which allows raw Perl datatypes to be
@@ -88,6 +110,11 @@ The global variable $Devel::Peek::pv_limit can be set to limit the
number of character printed in various string values. Setting it to 0
means no limit.
+If C<use Devel::Peek> directive has a C<:opd=FLAGS> argument,
+this switches on debugging of opcode dispatch. C<FLAGS> should be a
+combination of C<s>, C<t>, and C<P> (see B<-D> flags in L<perlrun>).
+C<:opd> is a shortcut for C<:opd=st>.
+
=head2 Runtime debugging
C<CvGV($cv)> return one of the globs associated to a subroutine reference $cv.