Minor patch to debugger
authorIlya Zakharevich <ilya@math.ohio-state.edu>
Fri, 29 Nov 1996 05:33:49 +0000 (00:33 -0500)
committerChip Salzenberg <chip@atlantic.net>
Fri, 29 Nov 1996 17:31:00 +0000 (05:31 +1200)
This makes the new behaviour a little bit more transparent (now you
need q to quit), and avoids one malloc/free pair in the signal handler.

p5p-msgid: <199611290533.AAA08053@monk.mps.ohio-state.edu>

lib/perl5db.pl

index 3f3a4c2..981b24e 100644 (file)
@@ -728,17 +728,17 @@ sub DB {
                        }
                        next CMD; };
                    $cmd =~ /^n$/ && do {
-                       next CMD if $finished and $level <= 1;
+                       end_report(), next CMD if $finished and $level <= 1;
                        $single = 2;
                        $laststep = $cmd;
                        last CMD; };
                    $cmd =~ /^s$/ && do {
-                       next CMD if $finished and $level <= 1;
+                       end_report(), next CMD if $finished and $level <= 1;
                        $single = 1;
                        $laststep = $cmd;
                        last CMD; };
                    $cmd =~ /^c\b\s*([\w:]*)\s*$/ && do {
-                       next CMD if $finished and $level <= 1;
+                       end_report(), next CMD if $finished and $level <= 1;
                        $i = $1;
                        if ($i =~ /\D/) { # subroutine name
                            ($file,$i) = ($sub{$i} =~ /^(.*):(.*)$/);
@@ -766,7 +766,7 @@ sub DB {
                        }
                        last CMD; };
                    $cmd =~ /^r$/ && do {
-                       next CMD if $finished and $level <= 1;
+                       end_report(), next CMD if $finished and $level <= 1;
                        $stack[$#stack] |= 1;
                        $doret = $option{PrintRet} ? $#stack - 1 : -2;
                        last CMD; };
@@ -1381,6 +1381,7 @@ sub get_list {
 
 sub catch {
     $signal = 1;
+    return;                    # Put nothing on the stack - malloc/free land!
 }
 
 sub warn {
@@ -1581,7 +1582,7 @@ R         Pure-man-restart of debugger, some of debugger state
                and command-line options may be lost.
 h [db_command] Get help [on a specific debugger command], enter |h to page.
 h h            Summary of debugger commands.
-q or ^D                Quit.
+q or ^D                Quit. Set \$DB::finished to 0 to debug global destruction.
 
 ";
     $summary = <<"END_SUM";
@@ -1813,9 +1814,11 @@ sub db_complete {
   return &readline::rl_filename_list($text); # filenames
 }
 
+sub end_report { print $OUT "Use `q' to quit and `R' to restart. `h q' for details.\n" }
+
 END {
   $finished = $inhibit_exit;   # So that some keys may be disabled.
-  $DB::single = 1; 
+  $DB::single = !$exiting;     # Do not trace destructors on exit
   DB::fake::at_exit() unless $exiting;
 }