Fix (and test) breakpoints on subroutines
authorVincent Pit <perl@profvince.com>
Mon, 25 Jun 2012 13:06:49 +0000 (15:06 +0200)
committerVincent Pit <perl@profvince.com>
Mon, 25 Jun 2012 13:21:02 +0000 (15:21 +0200)
They were broken since 'use strict' was added to the debugger.

MANIFEST
lib/perl5db.pl
lib/perl5db.t
lib/perl5db/t/fact [new file with mode: 0644]

index f9cb161..3fbacb5 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -4280,6 +4280,7 @@ lib/perl5db/t/disable-breakpoints-2       Test script used by perl5db.t
 lib/perl5db/t/disable-breakpoints-3    Test script used by perl5db.t
 lib/perl5db/t/EnableModule.pm  Tests for the Perl debugger
 lib/perl5db/t/eval-line-bug    Tests for the Perl debugger
+lib/perl5db/t/fact             Tests for the Perl debugger
 lib/perl5db/t/filename-line-breakpoint         Tests for the Perl debugger
 lib/perl5db/t/lvalue-bug       Tests for the Perl debugger
 lib/perl5db/t/MyModule.pm      Tests for the Perl debugger
index 755d645..b692f6f 100644 (file)
@@ -523,7 +523,7 @@ BEGIN {
 # Debugger for Perl 5.00x; perl5db.pl patch level:
 use vars qw($VERSION $header);
 
-$VERSION = '1.39';
+$VERSION = '1.39_01';
 
 $header = "perl5db.pl version $VERSION";
 
@@ -4118,7 +4118,7 @@ sub cmd_b {
         $subname =~ s/\'/::/g;
 
         # Qualify it into the current package unless it's already qualified.
-        $subname = "${'package'}::" . $subname unless $subname =~ /::/;
+        $subname = "${package}::" . $subname unless $subname =~ /::/;
 
         # Add main if it starts with ::.
         $subname = "main" . $subname if substr( $subname, 0, 2 ) eq "::";
@@ -4565,7 +4565,7 @@ sub cmd_b_sub {
         my $s = $subname;
 
         # Put it in this package unless it's already qualified.
-        $subname = "${'package'}::" . $subname
+        $subname = "${package}::" . $subname
           unless $subname =~ /::/;
 
         # Requalify it into CORE::GLOBAL if qualifying it into this
@@ -8493,7 +8493,7 @@ sub db_complete {
     # The search pattern is current package, ::, extract the next qualifier
     # Prefix and pack are set to undef.
     my ( $itext, $search, $prefix, $pack ) =
-      ( $text, "^\Q${'package'}::\E([^:]+)\$" );
+      ( $text, "^\Q${package}::\E([^:]+)\$" );
 
 =head3 C<b postpone|compile> 
 
@@ -9326,7 +9326,7 @@ sub cmd_pre580_b {
         $subname =~ s/\'/::/g;
 
         # Qualify it into the current package unless it's already qualified.
-        $subname = "${'package'}::" . $subname
+        $subname = "${package}::" . $subname
           unless $subname =~ /::/;
 
         # Add main if it starts with ::.
index c7633fc..634288c 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(30);
+plan(31);
 
 my $rc_filename = '.perldb';
 
@@ -808,6 +808,29 @@ package main;
         );
 }
 
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'b fact',
+                'c',
+                'c',
+                'c',
+                'n',
+                'print "<$n>"',
+                'q',
+            ],
+            prog => '../lib/perl5db/t/fact',
+        }
+    );
+
+    $wrapper->output_like(
+        qr/<3>/,
+        'b subroutine works fine',
+    );
+}
+
 END {
     1 while unlink ($rc_filename, $out_fn);
 }
diff --git a/lib/perl5db/t/fact b/lib/perl5db/t/fact
new file mode 100644 (file)
index 0000000..ac25eac
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+sub fact {
+    my $n = shift;
+    if ($n > 1) {
+        return $n * fact($n - 1);
+    } else {
+        return 1;
+    }
+}
+fact(5);