diff options
author | Mark-Jason Dominus <mjd@plover.com> | 2002-02-12 15:20:42 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-13 05:11:12 +0000 |
commit | d03c2a1b901127d77518bbc18d5271b287c9e28b (patch) | |
tree | a1cffd63acaaeff6736cdd7f6c80e6f927d67c99 /lib/dumpvar.pl | |
parent | 8c19e1b53a04299dd91f058f8d14822bb18b45e5 (diff) | |
download | perl-d03c2a1b901127d77518bbc18d5271b287c9e28b.tar.gz |
New debugger option 'dumpDepth' controls recursion depth of 'x' command
Message-ID: <20020213012042.25245.qmail@plover.com>
p4raw-id: //depot/perl@14670
Diffstat (limited to 'lib/dumpvar.pl')
-rw-r--r-- | lib/dumpvar.pl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl index 34a9c5971b..184faa39f3 100644 --- a/lib/dumpvar.pl +++ b/lib/dumpvar.pl @@ -30,7 +30,7 @@ sub main::dumpValue { local $^W=0; (print "undef\n"), return unless defined $_[0]; (print &stringify($_[0]), "\n"), return unless ref $_[0]; - dumpvar::unwrap($_[0],0); + dumpvar::unwrap($_[0],0, $_[1]); } # This one is good for variable names: @@ -115,7 +115,7 @@ sub DumpElem { join("' '", @{$v}[0..$tArrayDepth]) . "'$shortmore"; } else { print "$short\n"; - unwrap($_[0],$_[1]); + unwrap($_[0],$_[1],$_[2]); } } @@ -123,6 +123,8 @@ sub unwrap { return if $DB::signal; local($v) = shift ; local($s) = shift ; # extra no of spaces + local($m) = shift ; # maximum recursion depth + return if $m == 0; local(%v,@v,$sp,$value,$key,@sortKeys,$more,$shortmore,$short) ; local($tHashDepth,$tArrayDepth) ; @@ -187,7 +189,7 @@ sub unwrap { return if $DB::signal; $value = $ {$v}{$key} ; print "$sp", &stringify($key), " => "; - DumpElem $value, $s; + DumpElem $value, $s, $m-1; } print "$sp empty hash\n" unless @sortKeys; print "$sp$more" if defined $more ; @@ -218,7 +220,7 @@ sub unwrap { return if $DB::signal; print "$sp$num "; if (exists $v->[$num]) { - DumpElem $v->[$num], $s; + DumpElem $v->[$num], $s, $m-1; } else { print "empty slot\n"; } @@ -227,7 +229,7 @@ sub unwrap { print "$sp$more" if defined $more ; } elsif ( UNIVERSAL::isa($v, 'SCALAR') or ref $v eq 'REF' ) { print "$sp-> "; - DumpElem $$v, $s; + DumpElem $$v, $s, $m-1; } elsif ( UNIVERSAL::isa($v, 'CODE') ) { print "$sp-> "; dumpsub (0, $v); |