In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/a1fd55a836db9fd5204e4045c505ddc08cc47597?hp=1ebabb47e140c4b8dd1d47c3c821c655f6824a9a>

- Log -----------------------------------------------------------------
commit a1fd55a836db9fd5204e4045c505ddc08cc47597
Author: Ricardo Signes <[email protected]>
Date:   Mon Jun 10 18:19:53 2013 -0400

    perldelta for debugger @_ fix

M       pod/perldelta.pod

commit e0cd3692aa11b7fa9c65042d3a2ab05d31561ae2
Author: Shlomi Fish <[email protected]>
Date:   Sun May 26 18:55:48 2013 +0300

    Fix the mutability of @_ in perl -d.
    
    With a test.
    
    See Father C.'s comment on RT #118169.

M       lib/perl5db.pl
M       lib/perl5db.t

commit e3d167f6f658f94468bfebb782378eee0368e9f0
Author: Shlomi Fish <[email protected]>
Date:   Sun May 26 16:35:04 2013 +0300

    Fix for RT #118169
    
    https://rt.perl.org/rt3/Public/Bug/Display.html?id=118169
    
    subroutine arguments are no longer shown in perl debugger ( x @_ in perl
    -d) .
    
    Regression from perl-5.16.x due to the perl -d refactoring. Fixed with a
    test.

M       MANIFEST
M       lib/perl5db.pl
M       lib/perl5db.t
A       lib/perl5db/t/test-passing-at-underscore-to-x-etc
-----------------------------------------------------------------------

Summary of changes:
 MANIFEST                                          |    1 +
 lib/perl5db.pl                                    |   29 +++++++++-----
 lib/perl5db.t                                     |   46 ++++++++++++++++++++-
 lib/perl5db/t/test-passing-at-underscore-to-x-etc |   15 +++++++
 pod/perldelta.pod                                 |    5 ++
 5 files changed, 85 insertions(+), 11 deletions(-)
 create mode 100644 lib/perl5db/t/test-passing-at-underscore-to-x-etc

diff --git a/MANIFEST b/MANIFEST
index e76d4af..ee2ba1d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4170,6 +4170,7 @@ lib/perl5db/t/test-frame-option-1 Tests for the Perl 
debugger
 lib/perl5db/t/test-l-statement-1       Tests for the Perl debugger
 lib/perl5db/t/test-l-statement-2       Tests for the Perl debugger
 lib/perl5db/t/test-m-statement-1       Tests for the Perl debugger
+lib/perl5db/t/test-passing-at-underscore-to-x-etc      Tests for the Perl 
debugger
 lib/perl5db/t/test-PrintRet-option-1   Tests for the Perl debugger
 lib/perl5db/t/test-r-statement Tests for the Perl debugger
 lib/perl5db/t/test-warnLevel-option-1  Tests for the Perl debugger
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 881a9ec..ee272a8 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -744,7 +744,7 @@ sub eval {
     # Since we're only saving $@, we only have to localize the array element
     # that it will be stored in.
     local $saved[0];    # Preserve the old value of $@
-    eval { DB::save() };
+    eval { &DB::save };
 
     # Now see whether we need to report an error back to the user.
     if ($at) {
@@ -1793,7 +1793,8 @@ sub _DB__determine_if_we_should_break
         # see if we should stop. If so, remove the one-time sigil.
         elsif ($stop) {
             $evalarg = "\$DB::signal |= 1 if do {$stop}";
-            DB::eval();
+            # The &-call is here to ascertain the mutability of @_.
+            &DB::eval;
             # If the breakpoint is temporary, then delete its enabled status.
             if ($dbline{$line} =~ s/;9($|\0)/$1/) {
                 _cancel_breakpoint_temp_enabled_status($filename, $line);
@@ -2562,7 +2563,8 @@ sub DB {
     # Last line in the program.
     $max = $#dbline;
 
-    _DB__determine_if_we_should_break(@_);
+    # The &-call is here to ascertain the mutability of @_.
+    &_DB__determine_if_we_should_break;
 
     # Preserve the current stop-or-not, and see if any of the W
     # (watch expressions) has changed.
@@ -2655,7 +2657,8 @@ If there are any preprompt actions, execute those as well.
     # If there's an action, do it now.
     if ($action) {
         $evalarg = $action;
-        DB::eval();
+        # The &-call is here to ascertain the mutability of @_.
+        &DB::eval;
     }
 
     # Are we nested another level (e.g., did we evaluate a function
@@ -2667,7 +2670,8 @@ If there are any preprompt actions, execute those as well.
 
         # Do any pre-prompt actions.
         foreach $evalarg (@$pre) {
-            DB::eval();
+            # The &-call is here to ascertain the mutability of @_.
+            &DB::eval;
         }
 
         # Complain about too much recursion if we passed the limit.
@@ -3082,7 +3086,8 @@ any variables we might want to address in the C<DB> 
package.
             $evalarg = "\$^D = \$^D | \$DB::db_stop;\n$cmd";
 
             # Run *our* eval that executes in the caller's context.
-            DB::eval();
+            # The &-call is here to ascertain the mutability of @_.
+            &DB::eval;
 
             # Turn off the one-time-dump stuff now.
             if ($onetimeDump) {
@@ -3128,7 +3133,8 @@ again.
 
         # Evaluate post-prompt commands.
         foreach $evalarg (@$post) {
-            DB::eval();
+            # The &-call is here to ascertain the mutability of @_.
+            &DB::eval;
         }
     }    # if ($single || $signal)
 
@@ -5431,7 +5437,8 @@ sub cmd_i {
     my $line = shift;
     foreach my $isa ( split( /\s+/, $line ) ) {
         $evalarg = $isa;
-        ($isa) = DB::eval();
+        # The &-call is here to ascertain the mutability of @_.
+        ($isa) = &DB::eval;
         no strict 'refs';
         print join(
             ', ',
@@ -6000,7 +6007,8 @@ sub _add_watch_expr {
     # in the user's context. This version can handle expressions which
     # return a list value.
     $evalarg = $expr;
-    my ($val) = join( ' ', DB::eval() );
+    # The &-call is here to ascertain the mutability of @_.
+    my ($val) = join( ' ', &DB::eval);
     $val = ( defined $val ) ? "'$val'" : 'undef';
 
     # Save the current value of the expression.
@@ -10122,7 +10130,8 @@ sub cmd_pre580_W {
         # Get the current value of the expression.
         # Doesn't handle expressions returning list values!
         $evalarg = $1;
-        my ($val) = DB::eval();
+        # The &-call is here to ascertain the mutability of @_.
+        my ($val) = &DB::eval;
         $val = ( defined $val ) ? "'$val'" : 'undef';
 
         # Save it.
diff --git a/lib/perl5db.t b/lib/perl5db.t
index 4aff839..9a57960 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
     }
 }
 
-plan(114);
+plan(116);
 
 my $rc_filename = '.perldb';
 
@@ -812,6 +812,50 @@ sub _calc_trace_wrapper
     );
 }
 
+# Tests for x with @_
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'b 10',
+                'c',
+                'x @_',
+                'q',
+            ],
+            prog => '../lib/perl5db/t/test-passing-at-underscore-to-x-etc',
+        }
+    );
+
+    $wrapper->contents_like(
+        # qr/^0\s+HASH\([^\)]+\)\n\s+500 => 600\n/,
+        qr/Arg1.*?Capsula.*GreekHumor.*Socrates/ms,
+        q/x command test with '@_'./,
+    );
+}
+
+# Tests for mutating @_
+{
+    my $wrapper = DebugWrap->new(
+        {
+            cmds =>
+            [
+                'b 10',
+                'c',
+                'shift(@_)',
+                'print "\n\n\n(((" . join(",", @_) . ")))\n\n\n"',
+                'q',
+            ],
+            prog => '../lib/perl5db/t/test-passing-at-underscore-to-x-etc',
+        }
+    );
+
+    $wrapper->output_like(
+        qr/^\(\(\(Capsula,GreekHumor,Socrates\)\)\)$/ms,
+        q/Mutating '@_'./,
+    );
+}
+
 # Tests for x with AutoTrace=1.
 {
     my $wrapper = DebugWrap->new(
diff --git a/lib/perl5db/t/test-passing-at-underscore-to-x-etc 
b/lib/perl5db/t/test-passing-at-underscore-to-x-etc
new file mode 100644
index 0000000..ff14df6
--- /dev/null
+++ b/lib/perl5db/t/test-passing-at-underscore-to-x-etc
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+print "One\n";
+
+sub my_pass_args_to
+{
+    print "Two\n";
+}
+
+my_pass_args_to ("Arg1", "Capsula", "GreekHumor", "Socrates");
+
+print "Three\n";
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index d98ad3d..6c19aee 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -513,6 +513,11 @@ all now work again.
 
 =item *
 
+C<@_> is now correctly visible in the debugger, fixing a regression
+introduced in v5.18.0's debugger. [RT #118169]
+
+=item *
+
 Evaluating large hashes in scalar context is now much faster, as the number
 of used chains in the hash is now cached for larger hashes. Smaller hashes
 continue not to store it and calculate it when needed, as this saves one IV.

--
Perl5 Master Repository

Reply via email to