From: Nicholas Clark Date: Sat, 29 May 2010 15:23:53 +0000 (+0100) Subject: When assigning to $^P, don't zero $DB::single, $DB::trace and $DB::signal. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4c0f30d62c000e3bbbd4f45eb9fd4bd4b4015cf9;p=p5sagit%2Fp5-mst-13.2.git When assigning to $^P, don't zero $DB::single, $DB::trace and $DB::signal. Previously, whenever a true value was assigned to $^P, all 3 were set to 0. Now only set them to 0 if they aren't already SvIOK(). Resolves RT #72422. --- diff --git a/perl.c b/perl.c index 5b61f94..3e703a0 100644 --- a/perl.c +++ b/perl.c @@ -3787,11 +3787,14 @@ Perl_init_debugger(pTHX) PL_DBline = gv_fetchpvs("DB::dbline", GV_ADDMULTI, SVt_PVAV); PL_DBsub = gv_HVadd(gv_fetchpvs("DB::sub", GV_ADDMULTI, SVt_PVHV)); PL_DBsingle = GvSV((gv_fetchpvs("DB::single", GV_ADDMULTI, SVt_PV))); - sv_setiv(PL_DBsingle, 0); + if (!SvIOK(PL_DBsingle)) + sv_setiv(PL_DBsingle, 0); PL_DBtrace = GvSV((gv_fetchpvs("DB::trace", GV_ADDMULTI, SVt_PV))); - sv_setiv(PL_DBtrace, 0); + if (!SvIOK(PL_DBtrace)) + sv_setiv(PL_DBtrace, 0); PL_DBsignal = GvSV((gv_fetchpvs("DB::signal", GV_ADDMULTI, SVt_PV))); - sv_setiv(PL_DBsignal, 0); + if (!SvIOK(PL_DBsignal)) + sv_setiv(PL_DBsignal, 0); PL_curstash = ostash; } diff --git a/t/op/magic.t b/t/op/magic.t index 60d81ae..7e8ab8c 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -12,7 +12,7 @@ BEGIN { use warnings; use Config; -plan (tests => 83); +plan (tests => 85); $Is_MSWin32 = $^O eq 'MSWin32'; $Is_NetWare = $^O eq 'NetWare'; @@ -538,3 +538,16 @@ foreach my $sig (qw(__DIE__ _BOGUS_HOOK KILL THIRSTY)) { is int $!, 9999, q{[perl #72850] Core dump in bleadperl from perl -e '$! = 9999; $a = $!;'}; } + +{ + #RT #72422 + foreach my $p (0, 1) { + fresh_perl_is(<<"EOP", '2 4 8', undef, "test \$^P = $p"); +\$DB::single = 2; +\$DB::trace = 4; +\$DB::signal = 8; +\$^P = $p; +print "\$DB::single \$DB::trace \$DB::signal"; +EOP + } +}