Fix running actions after stepping in a debugger

This commit is contained in:
Petr Písař 2020-08-05 13:34:59 +02:00
parent 87c764208f
commit e47d422d1b
4 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,30 @@
From 3c53c6179afbdbef748c110abdb849cb463c2727 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Thu, 30 Jul 2020 17:42:47 -0500
Subject: [PATCH] Add missing MANIFEST entry from fix for debugger
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add on fix to #17901
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
MANIFEST | 1 +
1 file changed, 1 insertion(+)
diff --git a/MANIFEST b/MANIFEST
index 990a75ad52..12601e46b4 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4826,6 +4826,7 @@ 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-a-statement-3 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
--
2.25.4

View File

@ -0,0 +1,90 @@
From b248789b64d6bd277c52bfe608ed3192023af1bd Mon Sep 17 00:00:00 2001
From: "E. Choroba" <choroba@matfyz.cz>
Date: Fri, 26 Jun 2020 21:19:24 +0200
Subject: [PATCH] After running an action in the debugger, turn it off
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When running with "c", there was no problem, but when running with "n"
or "s", once the action was executed, it kept executing on the
following lines, which wasn't expected. Clearing $action here prevents
this unwanted behaviour.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/perl5db.pl | 3 ++-
lib/perl5db.t | 22 ++++++++++++++++++++++
lib/perl5db/t/test-a-statement-3 | 6 ++++++
3 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 lib/perl5db/t/test-a-statement-3
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index 69a9bb6e64..e04a0e17fa 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -529,7 +529,7 @@ BEGIN {
use vars qw($VERSION $header);
# bump to X.XX in blead, only use X.XX_XX in maint
-$VERSION = '1.57';
+$VERSION = '1.58';
$header = "perl5db.pl version $VERSION";
@@ -2708,6 +2708,7 @@ If there are any preprompt actions, execute those as well.
# The &-call is here to ascertain the mutability of @_.
&DB::eval;
}
+ undef $action;
# Are we nested another level (e.g., did we evaluate a function
# that had a breakpoint in it at the debugger prompt)?
diff --git a/lib/perl5db.t b/lib/perl5db.t
index 421229a54a..913a301d98 100644
--- a/lib/perl5db.t
+++ b/lib/perl5db.t
@@ -2799,6 +2799,28 @@ SKIP:
);
}
+{
+ # GitHub #17901
+ my $wrapper = DebugWrap->new(
+ {
+ cmds =>
+ [
+ 'a 4 $s++',
+ ('s') x 5,
+ 'x $s',
+ 'q'
+ ],
+ prog => '../lib/perl5db/t/test-a-statement-3',
+ switches => [ '-d' ],
+ stderr => 0,
+ }
+ );
+ $wrapper->contents_like(
+ qr/^0 +2$/m,
+ 'Test that the a command runs only on the given lines.',
+ );
+}
+
{
# perl 5 RT #126735 regression bug.
local $ENV{PERLDB_OPTS} = "NonStop=0 RemotePort=non-existent-host.tld:9001";
diff --git a/lib/perl5db/t/test-a-statement-3 b/lib/perl5db/t/test-a-statement-3
new file mode 100644
index 0000000000..b188c1c5c5
--- /dev/null
+++ b/lib/perl5db/t/test-a-statement-3
@@ -0,0 +1,6 @@
+use strict; use warnings;
+
+for my $x (1 .. 2) {
+ my $y = $x + 1;
+ my $x = $x - 1;
+}
--
2.25.4

View File

@ -0,0 +1,33 @@
From 589464a875768e4b4a609d972488e3b592103097 Mon Sep 17 00:00:00 2001
From: "E. Choroba" <choroba@matfyz.cz>
Date: Mon, 27 Jul 2020 11:32:51 +0200
Subject: [PATCH] Clearing DB::action at the end is no longer needed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
as it's cleared right after it's been run.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/perl5db.pl | 4 ----
1 file changed, 4 deletions(-)
diff --git a/lib/perl5db.pl b/lib/perl5db.pl
index e04a0e17fa..af3b972da0 100644
--- a/lib/perl5db.pl
+++ b/lib/perl5db.pl
@@ -3347,10 +3347,6 @@ use B<o> I<inhibit_exit> to avoid stopping after program termination,
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')
--
2.25.4

View File

@ -187,6 +187,12 @@ Patch20: perl-5.32.0-Fix-404-and-text-in-New-Unicode-properties-section.p
# in upstream after 5.33.0
Patch21: perl-5.33.0-IO-Socket-UNIX-synchronize-behavior-with-module-docu.patch
# Fix running actions after stepping in a debugger, GH#17901,
# in upstream after 5.33.0
Patch22: perl-5.33.0-After-running-an-action-in-the-debugger-turn-it-off.patch
Patch23: perl-5.33.0-Clearing-DB-action-at-the-end-is-no-longer-needed.patch
Patch24: perl-5.33.0-Add-missing-MANIFEST-entry-from-fix-for-debugger.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -4194,6 +4200,9 @@ you're not running VMS, this module does nothing.
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch200 -p1
%patch201 -p1
@ -4222,6 +4231,9 @@ perl -x patchlevel.h \
'Fedora Patch19: Fix IO::Handle::error() to report write errors (GH#6799)' \
'Fedora Patch20: Fix a link to Unicode Technical Standard #18 (GH#17881)' \
'Fedora Patch21: Fix setting a non-blocking mode in IO::Socket::UNIX (GH#17787)' \
'Fedora Patch22: Fix running actions after stepping in a debugger (GH#17901)' \
'Fedora Patch23: Fix running actions after stepping in a debugger (GH#17901)' \
'Fedora Patch24: Fix running actions after stepping in a debugger (GH#17901)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -6947,6 +6959,7 @@ popd
- Fix IO::Handle::error() to report write errors (GH#6799)
- Fix a link to Unicode Technical Standard #18 (GH#17881)
- Fix setting a non-blocking mode in IO::Socket::UNIX (GH#17787)
- Fix running actions after stepping in a debugger (GH#17901)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4:5.32.0-458
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild