New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subroutine arguments are no longer shown in perl debugger ( x @_ in perl -d) #12991
Comments
From dotandimet@gmail.comThis is a bug report for perl from dotan@corky.net, In perl 5.18.0, @_ isn't visible in the debugger (perl -d). Example: Flags: Site configuration information for perl 5.18.0: Configured by dotandimet at Mon May 20 22:37:44 IDT 2013. Summary of my perl5 (revision 5 version 18 subversion 0) configuration: Platform: Locally applied patches: @INC for perl 5.18.0: Environment for perl 5.18.0: |
From @jkeenanOn Fri May 24 22:24:07 2013, dotandimet@gmail.com wrote:
This does seem to be a regression from 5.16.0: ##### Loading DB routines from perl5db.pl version 1.37 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(118169-debug.pl:4): use Data::Dumper;$Data::Dumper::Indent=1; |
The RT System itself - Status changed from 'new' to 'open' |
From @cpansproutOn Sat May 25 17:33:45 2013, jkeenan wrote:
It was caused by: commit 7c54f46 perl5db: no longer passing arguments to DB::eval(). Inline Patchdiff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 54de27a..87713a5 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -741,7 +741,7 @@ sub eval {
# Since we're only saving $@, we only have to localize the array
# Now see whether we need to report an error back to the user. # If there's an action, do it now. # Are we nested another level (e.g., did we evaluate a function # Do any pre-prompt actions. # Complain about too much recursion if we passed the limit. # Run *our* eval that executes in the caller's context. # Turn off the one-time-dump stuff now. # Evaluate post-prompt commands. @@ -3477,7 +3477,7 @@ sub _DB__handle_watch_expressions # Fix context DB::eval() wants to return an array, but # Did it change? # Ooops. Bad scalar. # Save the current value of the expression. # Save it. -- Father Chrysostomos |
From @jkeenanOn Sun May 26 01:29:38 2013, sprout wrote:
The patch attached represents *manual* corrections to the commit in The patch appears to correct the 'x @_' case reported by the OP and ##### Loading DB routines from perl5db.pl version 1.39_10 Enter h or 'h h' for help, or 'man perldebug' for more help. main::(/home/jkeenan/p5p/118169-debug.pl:7): I'm not familiar enough with 'w' to say whether my patch remedies that Please review. Thank you very much. |
From @jkeenan118169-Manual-corrections-pass-_-to-eval.patchFrom f057ecd027ba98f928a1d1e3996e93637a455e84 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sun, 26 May 2013 14:40:15 +0200
Subject: [PATCH] Manual corrections: pass @_ to eval().
Intended to have the effect of reverting
7c54f46a95be02b1ca921f4d4521122267d801cd. For RT #118169.
---
lib/perl5db.pl | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 0705341..ca6c97d 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) {
@@ -2655,7 +2655,7 @@ If there are any preprompt actions, execute those as well.
# If there's an action, do it now.
if ($action) {
$evalarg = $action;
- DB::eval();
+ DB::eval(@_);
}
# Are we nested another level (e.g., did we evaluate a function
@@ -2667,7 +2667,7 @@ If there are any preprompt actions, execute those as well.
# Do any pre-prompt actions.
foreach $evalarg (@$pre) {
- DB::eval();
+ DB::eval(@_);
}
# Complain about too much recursion if we passed the limit.
@@ -3082,7 +3082,7 @@ 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();
+ DB::eval(@_);
# Turn off the one-time-dump stuff now.
if ($onetimeDump) {
@@ -3128,7 +3128,7 @@ again.
# Evaluate post-prompt commands.
foreach $evalarg (@$post) {
- DB::eval();
+ DB::eval(@_);
}
} # if ($single || $signal)
@@ -5431,7 +5431,7 @@ sub cmd_i {
my $line = shift;
foreach my $isa ( split( /\s+/, $line ) ) {
$evalarg = $isa;
- ($isa) = DB::eval();
+ ($isa) = DB::eval(@_);
no strict 'refs';
print join(
', ',
@@ -5494,7 +5494,7 @@ sub _cmd_l_handle_var_name {
$evalarg = $var_name;
- my ($s) = DB::eval();
+ my ($s) = DB::eval(@_);
# Ooops. Bad scalar.
if ($@) {
@@ -6000,7 +6000,7 @@ 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() );
+ my ($val) = join( ' ', DB::eval(@_) );
$val = ( defined $val ) ? "'$val'" : 'undef';
# Save the current value of the expression.
@@ -10122,7 +10122,7 @@ sub cmd_pre580_W {
# Get the current value of the expression.
# Doesn't handle expressions returning list values!
$evalarg = $1;
- my ($val) = DB::eval();
+ my ($val) = DB::eval(@_);
$val = ( defined $val ) ? "'$val'" : 'undef';
# Save it.
--
1.7.1
|
From @shlomifHi all, On Sun May 26 05:51:24 2013, jkeenan wrote:
Attached is my own patch which appears to correct the problem (at least You can also find it at this github branch: https://github.com/shlomif/perl/tree/rt118169_fix_perl_debugger_at_underscore_in_x Regards, -- Shlomi Fish |
From @shlomif0001-Fix-for-RT-118169.patchFrom c4670f079de4be1ffd036f5eac53f3e8870ae292 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Sun, 26 May 2013 16:35:04 +0300
Subject: [PATCH] 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.
---
MANIFEST | 1 +
lib/perl5db.pl | 18 ++++++++---------
lib/perl5db.t | 24 ++++++++++++++++++++++-
lib/perl5db/t/test-passing-at-underscore-to-x-etc | 15 ++++++++++++++
4 files changed, 48 insertions(+), 10 deletions(-)
create mode 100644 lib/perl5db/t/test-passing-at-underscore-to-x-etc
diff --git a/MANIFEST b/MANIFEST
index e3e3b8f..f861073 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4155,6 +4155,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 0705341..1be7581 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,7 @@ 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();
+ 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);
@@ -2655,7 +2655,7 @@ If there are any preprompt actions, execute those as well.
# If there's an action, do it now.
if ($action) {
$evalarg = $action;
- DB::eval();
+ DB::eval(@_);
}
# Are we nested another level (e.g., did we evaluate a function
@@ -2667,7 +2667,7 @@ If there are any preprompt actions, execute those as well.
# Do any pre-prompt actions.
foreach $evalarg (@$pre) {
- DB::eval();
+ DB::eval(@_);
}
# Complain about too much recursion if we passed the limit.
@@ -3082,7 +3082,7 @@ 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();
+ DB::eval(@_);
# Turn off the one-time-dump stuff now.
if ($onetimeDump) {
@@ -3128,7 +3128,7 @@ again.
# Evaluate post-prompt commands.
foreach $evalarg (@$post) {
- DB::eval();
+ DB::eval(@_);
}
} # if ($single || $signal)
@@ -5431,7 +5431,7 @@ sub cmd_i {
my $line = shift;
foreach my $isa ( split( /\s+/, $line ) ) {
$evalarg = $isa;
- ($isa) = DB::eval();
+ ($isa) = DB::eval(@_);
no strict 'refs';
print join(
', ',
@@ -6000,7 +6000,7 @@ 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() );
+ my ($val) = join( ' ', DB::eval(@_) );
$val = ( defined $val ) ? "'$val'" : 'undef';
# Save the current value of the expression.
@@ -10122,7 +10122,7 @@ sub cmd_pre580_W {
# Get the current value of the expression.
# Doesn't handle expressions returning list values!
$evalarg = $1;
- my ($val) = DB::eval();
+ my ($val) = DB::eval(@_);
$val = ( defined $val ) ? "'$val'" : 'undef';
# Save it.
diff --git a/lib/perl5db.t b/lib/perl5db.t
index 81bd5da..d4d7bd4 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(114);
+plan(115);
my $rc_filename = '.perldb';
@@ -812,6 +812,28 @@ 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 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";
--
1.8.1.5
|
From @shlomifHi Jim, On Sun May 26 05:51:24 2013, jkeenan wrote:
My patch contains a regression test, but its regex can be made more
Well, this patch still needs a regression test.
Regards, -- Shlomi Fish |
From @cpansproutOn Sun May 26 06:45:09 2013, shlomif wrote:
https://github.com/shlomif/perl/tree/rt118169_fix_perl_debugger_at_underscore_in_x I haven’t had a chance to test your patch yet. But also consider $ perl -v This is perl 5, version 12, subversion 4 (v5.12.4) built for Copyright 1987-2010, Larry Wall Perl may be copied only under the terms of either the Artistic License Complete documentation for Perl, including FAQ lists, should be found on $ perl -de 'BEGIN{@DB::typeahead=("s","shift \@_", "c", "q");} sub f { Loading DB routines from perl5db.pl version 1.33 Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): BEGIN{@DB::typeahead=("s","shift \@_", "c", "q");} sub f { auto(-2) DB<2> c That fails in current blead (prints ‘1 2 3’). I haven’t checked whether -- Father Chrysostomos |
From @shlomifHi Father C, On Sun May 26 07:44:41 2013, sprout wrote:
https://github.com/shlomif/perl/tree/rt118169_fix_perl_debugger_at_underscore_in_x
Checked now, and it didn't. I've written another patch to address it in https://github.com/shlomif/perl/tree/rt118169_fix_perl_debugger_at_underscore_in_x Regards, -- Shlomi Fish |
From @shlomif0001-Fix-the-mutability-of-_-in-perl-d.patchFrom 35ead187368d8990f8cbd03fecbcd9458d8067b4 Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Sun, 26 May 2013 18:55:48 +0300
Subject: [PATCH] Fix the mutability of @_ in perl -d.
With a test.
See Father C.'s comment on RT #118169.
---
lib/perl5db.pl | 27 ++++++++++++++++++---------
lib/perl5db.t | 24 +++++++++++++++++++++++-
2 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 1be7581..9afe3f3 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -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 8b81c6a..34aed9f 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -28,7 +28,7 @@ BEGIN {
}
}
-plan(115);
+plan(116);
my $rc_filename = '.perldb';
@@ -834,6 +834,28 @@ sub _calc_trace_wrapper
);
}
+# 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(
--
1.8.1.5
|
From @rjbsThanks. I have applied Shlomi's patches to blead and am now smoking them on maint-5.18 for -- |
From [Unknown Contact. See original ticket]Thanks. I have applied Shlomi's patches to blead and am now smoking them on maint-5.18 for -- |
@rjbs - Status changed from 'open' to 'resolved' |
From @shlomifOn Mon, 10 Jun 2013 15:24:45 -0700
Thanks for applying the patches. Regards, Shlomi Fish -- Shlomi Fish http://www.shlomifish.org/ One of Buffy the Vampire Slayer’s episodes took place in the NSA headquarters, Please reply to list if it's a mailing list post - http://shlom.in/reply . |
Migrated from rt.perl.org#118169 (status was 'resolved')
Searchable as RT118169$
The text was updated successfully, but these errors were encountered: