-
Notifications
You must be signed in to change notification settings - Fork 548
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
Bug [5.11.3] debugger bug in evaluation of user actions ('a' command) #10034
Comments
From heiko.eissfeldt@hexco.deThis is a bug report for perl from heiko@hexco.de, Hello all, I am having a little trouble with the action command 'a' For example when i use the following little program with the Can this be written into a test? simple.pl:use strict; use warnings; greet('Hello'); sub greet
|
From @obraThanks for the report. I've confirmed that this issue also manifests -Jesse On Mon 28.Dec'09 at 10:05:58 -0800, heiko.eissfeldt@hexco.de (via RT) wrote:
|
The RT System itself - Status changed from 'new' to 'open' |
From heiko@hexco.deThe following one-line patch fixes the issue for me. After the program has terminated, the action should be set to undef to Greetings, heiko |
From heiko@hexco.de71678_perldb.pl.patch--- perl5db.pl.org 2009-10-20 15:40:18.000000000 +0200
+++ perl5db.pl 2010-01-02 22:29:37.000000000 +0100
@@ -2077,6 +2077,7 @@
EOP
# Set the DB::eval context appropriately.
+ $action = undef;
$package = 'main';
$usercontext =
'($@, $!, $^E, $,, $/, $\, $^W) = @saved;'
|
From heiko@hexco.deJesse Vincent schrieb:
The following one-line patch fixes the issue for me. After the program has terminated, the action should be set to undef to Greetings, heiko |
From heiko@hexco.de71678_perldb.pl.patch--- perl5db.pl.org 2009-10-20 15:40:18.000000000 +0200
+++ perl5db.pl 2010-01-02 22:29:37.000000000 +0100
@@ -2077,6 +2077,7 @@
EOP
# Set the DB::eval context appropriately.
+ $action = undef;
$package = 'main';
$usercontext =
'($@, $!, $^E, $,, $/, $\, $^W) = @saved;'
|
From heiko@hexco.deDear porters, maybe my patch for perl #71678 'debugger bug in evaluation of After the program to be debugged has terminated, any user defined Or should those actions be preserved for a possible next run? Please check and consider for integration. I would also like to point you to the patch for perl #71806 Keep up the good work, |
From heiko@hexco.de71678.patch--- perl5db.pl.org 2010-02-13 18:15:08.000000000 +0100
+++ perl5db.pl 2010-02-21 21:32:47.000000000 +0100
@@ -511,7 +511,7 @@
BEGIN {eval 'use IO::Handle'}; # Needed for flush only? breaks under miniperl
# Debugger for Perl 5.00x; perl5db.pl patch level:
-$VERSION = '1.33';
+$VERSION = '1.34';
$header = "perl5db.pl version $VERSION";
@@ -952,6 +952,9 @@
# Changes: 1.32: Jun 03, 2009 Jonathan Leto <jonathan@leto.net>
# + Fix bug where a key _< with undefined value was put into the symbol table
# + when the $filename variable is not set
+# Changes: 1.34: Feb 21, 2010 Heiko Eissfeldt <heiko@hexco.de>
+# + Fix a bug where a user defined action was called after the program
+# + terminated.
########################################################################
=head1 DEBUGGER INITIALIZATION
@@ -2077,6 +2080,8 @@
EOP
# Set the DB::eval context appropriately.
+ # At program termination disable any user actions.
+ $action = undef;
$package = 'main';
$usercontext =
'($@, $!, $^E, $,, $/, $\, $^W) = @saved;'
|
From @iabynOn Sun, Feb 21, 2010 at 09:51:18PM +0100, Heiko Eißfeldt wrote:
Thanks for this effort. However, we are currently in the last stages of -- |
From @cpansproutOn Mon Feb 22 13:32:09 2010, hexcoder wrote:
I don’ think it has to do with the end of the program. This script BEGIN { greet('Hello'); sub greet |
From heiko@hexco.deGreetings, I agree now it had nothing todo with the end of the program. So the evaluation needs to take the line number into account, which it Note: this is not related to perlbug #71806 'perldb does not setup
I propose this example (see attachment), which uses a lexical variable greet('Hello'); # first stop in debugger sub greet Thanks, hexcoder |
From @jkeenanOn Tue Sep 28 01:07:49 2010, hexcoder wrote:
Discussion of this issue petered out about a year-and-a-half ago. Is Thank you very much. |
From @jkeenanOn Tue Mar 27 18:24:27 2012, jkeenan wrote:
There have been many discussions about the Perl debugger on P5P during Thank you very much. |
From @rockyHere is my short assessment: ick. Here is the longer story, as best as I can tell, of what might be going on. The debugger action command stores the action code string to be eval'd in But the code in DB:DB() is long, tortuous and there are a number of The branch taken when the program has terminated seems to get run before hexcoder's one-line patch is in my opinion a valid in that it deals with But as subsequently noted, there are other possibilities and the one-line In Devel::Trepan <https://metacpan.org/module/Devel::Trepan>, I use a On Sun, Jan 27, 2013 at 8:11 PM, James E Keenan via RT <
|
From @kevindawsonI suspect this is another item fixed by shlom-fish wake :) $ perl -d ~/workspace/p5p/script/simple.pl 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/kevin/workspace/p5p/script/simple.pl:8): imho this is now fixed |
From [Unknown Contact. See original ticket]I suspect this is another item fixed by shlom-fish wake :) $ perl -d ~/workspace/p5p/script/simple.pl 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/kevin/workspace/p5p/script/simple.pl:8): imho this is now fixed |
From @shlomifOn Sat Aug 24 15:20:38 2013, bowtie wrote:
This item was not fixed, and the reason you did not exhibit it is because you forgot to add the "-w" flag. With the "-w" flag I'm still getting the erroneous behaviour. Attached is a git patch against bleadperl to fix the problem (or at least these particular symptoms) with a test added based on this bug. It can also be found here: https://github.com/shlomif/perl/tree/rt71678--perl5db--a-statement-after-exit Please apply it some time after the release of perl-5.22.0. Best regards, -- Shlomi Fish |
From @shlomif0001-Fix-RT-71678-d-a-command-after-exit-with-a-test.patchFrom c0d8bec5e0c3ef31bd522c22f380f18480f11afc Mon Sep 17 00:00:00 2001
From: Shlomi Fish <shlomif@shlomifish.org>
Date: Mon, 25 May 2015 20:56:23 +0300
Subject: [PATCH] Fix RT#71678 (-d a command after exit) with a test.
Credits to Heiko Eissfeldt for the reported bug, the test program and a
proposed fix.
---
MANIFEST | 1 +
lib/perl5db.pl | 5 ++++-
lib/perl5db.t | 27 ++++++++++++++++++++++++++-
lib/perl5db/t/test-a-statement-2 | 10 ++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
create mode 100644 lib/perl5db/t/test-a-statement-2
diff --git a/MANIFEST b/MANIFEST
index 4278740..df05d3b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4228,6 +4228,7 @@ lib/perl5db/t/source-cmd-test.perldb Tests for the Perl debugger
lib/perl5db/t/symbol-table-bug Tests for the Perl debugger
lib/perl5db/t/taint Tests for the Perl debugger
lib/perl5db/t/test-a-statement-1 Tests for the Perl debugger
+lib/perl5db/t/test-a-statement-2 Tests for the Perl debugger
lib/perl5db/t/test-dieLevel-option-1 Tests for the Perl debugger
lib/perl5db/t/test-frame-option-1 Tests for the Perl debugger
lib/perl5db/t/test-l-statement-1 Tests for the Perl debugger
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 7e7194e..0d240ae 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -528,7 +528,7 @@ BEGIN {
# Debugger for Perl 5.00x; perl5db.pl patch level:
use vars qw($VERSION $header);
-$VERSION = '1.49';
+$VERSION = '1.49_01';
$header = "perl5db.pl version $VERSION";
@@ -3319,6 +3319,9 @@ B<h q>, B<h R> or B<h o> to get additional info.
EOP
# Set the DB::eval context appropriately.
+ # At program termination disable any user actions.
+ $DB::action = undef;
+
$DB::package = 'main';
$DB::usercontext = DB::_calc_usercontext($DB::package);
} ## end elsif ($package eq 'DB::fake')
diff --git a/lib/perl5db.t b/lib/perl5db.t
index e93aee0..98a3686 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -29,7 +29,7 @@ BEGIN {
$ENV{PERL_RL} = 'Perl'; # Suppress system Term::ReadLine::Gnu
}
-plan(120);
+plan(121);
my $rc_filename = '.perldb';
@@ -2774,6 +2774,31 @@ SKIP:
);
}
+# [perl #71678] debugger bug in evaluation of user actions ('a' command)
+# Still evaluated after the script finishes.
+{
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ q#a 9 print " \$arg = $arg\n"#,
+ 'c 9',
+ 's',
+ 'q',
+ ],
+ prog => '../lib/perl5db/t/test-a-statement-2',
+ switches => [ '-dw', ],
+ stderr => 1,
+ }
+ );
+
+ $wrapper->contents_unlike(qr/
+ Use\ of\ uninitialized\ value\ \$arg\ in\ concatenation\ [\S ]+\ or\ string\ at
+ /msx,
+ 'Test that the a command does not emit warnings on program exit.',
+ );
+}
+
END {
1 while unlink ($rc_filename, $out_fn);
}
diff --git a/lib/perl5db/t/test-a-statement-2 b/lib/perl5db/t/test-a-statement-2
new file mode 100644
index 0000000..0a3d304
--- /dev/null
+++ b/lib/perl5db/t/test-a-statement-2
@@ -0,0 +1,10 @@
+use strict; use warnings;
+
+greet('Hello');
+
+sub greet
+{
+ my $arg = shift;
+ print "$arg\n";
+ return;
+}
--
1.8.5.6
|
From @tonycozOn Mon May 25 11:12:13 2015, shlomif wrote:
Added to my post-5.22 branch. Tony |
From @tonycozOn Mon May 25 11:12:13 2015, shlomif wrote:
Thanks, applied as 0b1fcdc. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
@tonycoz - Status changed from 'resolved' to 'pending release' |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#71678 (status was 'resolved')
Searchable as RT71678$
The text was updated successfully, but these errors were encountered: