From 4c82ae22ce2b9a6d9891a286b3b4d41b58d56d4e Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 19 Mar 2000 06:30:11 +0000 Subject: [PATCH] default warnLevel and dieLevel to 0 in debugger (from Tom Christiansen); make dumpvar.pl safe against non-glob entries in stashes p4raw-id: //depot/perl@5818 --- lib/Dumpvalue.pm | 3 ++- lib/dumpvar.pl | 4 +++- lib/perl5db.pl | 14 +++++++------- pod/perldebug.pod | 33 +++++++++++++++++++++++---------- 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/lib/Dumpvalue.pm b/lib/Dumpvalue.pm index 94b6aa6..5d3a9da 100644 --- a/lib/Dumpvalue.pm +++ b/lib/Dumpvalue.pm @@ -404,7 +404,8 @@ sub dumpvars { next if @vars && !grep( matchvar($key, $_), @vars ); if ($self->{usageOnly}) { $self->globUsage(\$val, $key) - unless $package eq 'Dumpvalue' and $key eq 'stab'; + if ($package ne 'Dumpvalue' or $key ne 'stab') + and ref(\$val) eq 'GLOB'; } else { $self->dumpglob($package, 0,$key, $val); } diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl index c727818..4a3041a 100644 --- a/lib/dumpvar.pl +++ b/lib/dumpvar.pl @@ -361,7 +361,9 @@ sub main::dumpvar { return if $DB::signal; next if @vars && !grep( matchvar($key, $_), @vars ); if ($usageOnly) { - globUsage(\$val, $key) unless $package eq 'dumpvar' and $key eq 'stab'; + globUsage(\$val, $key) + if ($package ne 'dumpvar' or $key ne 'stab') + and ref(\$val) eq 'GLOB'; } else { dumpglob(0,$key, $val); } diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 23fcb1c..132e08e 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -273,13 +273,13 @@ $inhibit_exit = $option{PrintRet} = 1; ); # These guys may be defined in $ENV{PERL5DB} : -$rl = 1 unless defined $rl; -$warnLevel = 1 unless defined $warnLevel; -$dieLevel = 1 unless defined $dieLevel; -$signalLevel = 1 unless defined $signalLevel; -$pre = [] unless defined $pre; -$post = [] unless defined $post; -$pretype = [] unless defined $pretype; +$rl = 1 unless defined $rl; +$warnLevel = 0 unless defined $warnLevel; +$dieLevel = 0 unless defined $dieLevel; +$signalLevel = 1 unless defined $signalLevel; +$pre = [] unless defined $pre; +$post = [] unless defined $post; +$pretype = [] unless defined $pretype; warnLevel($warnLevel); dieLevel($dieLevel); diff --git a/pod/perldebug.pod b/pod/perldebug.pod index ead5414..1750f1a 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -488,16 +488,23 @@ Run Tk while prompting (with ReadLine). =item C, C, C -Level of verbosity. By default, the debugger prints backtraces -upon receiving any kind of warning (this is often annoying) and -fatal exceptions (this is often valuable). It will attempt to print -a message when uncaught INT, BUS, or SEGV signals arrive. - -To disable this behaviour, set these values to 0. If C -is 2, the debugger usurps your own exception handler and prints out -a trace of these, replacing your exceptions with its own. This may -be useful for some tracing purposes, but tends to hopelessly destroy -any program that takes its exception handling seriously. +Level of verbosity. By default, the debugger leaves your exceptions +and warnings alone, because altering them can break correctly running +programs. It will attempt to print a message when uncaught INT, BUS, or +SEGV signals arrive. (But see the mention of signals in L below.) + +To disable this default safe mode, set these values to something higher +than 0. At a level of 1, you get backtraces upon receiving any kind +of warning (this is often annoying) or exception (this is +often valuable). Unfortunately, the debugger cannot discern fatal +exceptions from non-fatal ones. If C is even 1, then your +non-fatal exceptions are also traced and unceremoniously altered if they +came from C strings or from any kind of C within modules +you're attempting to load. If C is 2, the debugger doesn't +care where they came from: It usurps your exception handler and prints +out a trace, then modifies all exceptions with its own embellishments. +This may perhaps be useful for some tracing purposes, but tends to hopelessly +destroy any program that takes its exception handling seriously. =item C @@ -929,3 +936,9 @@ that were not compiled by Perl, such as those from C or C++ extensions. If you alter your @_ arguments in a subroutine (such as with B or B, the stack backtrace will not show the original values. + +If you're in a slow syscall (like Cing, Cing, or Cing +from your keyboard or a socket) and haven't set up your own C<$SIG{INT}> +handler, then you won't be able to CTRL-C your way back to the debugger, +because the debugger's own C<$SIG{INT}> handler doesn't understand that +it needs to raise an exception to longjmp(3) out of slow syscalls. -- 2.7.4