Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -5451,6 +5451,7 @@ lib/perl5db/t/gh-17660 Tests for the Perl debugger
lib/perl5db/t/gh-17661 Tests for the Perl debugger
lib/perl5db/t/gh-17661b Tests for the Perl debugger
lib/perl5db/t/gh-21350 Tests for the Perl debugger
lib/perl5db/t/gh-23663 Tests for the Perl debugger
lib/perl5db/t/load-modules Tests for the Perl debugger
lib/perl5db/t/lsub-n Test script used by perl5db.t
lib/perl5db/t/lvalue-bug Tests for the Perl debugger
Expand Down
34 changes: 20 additions & 14 deletions lib/dumpvar.pl
Original file line number Diff line number Diff line change
Expand Up @@ -477,26 +477,32 @@ sub main::dumpvar {
$package .= "::" unless $package =~ /::$/;
*stab = *{"main::"};
while ($package =~ /(\w+?::)/g){
*stab = $ {stab}{$1};
*stab = $ {stab}{$1};
}
local $TotalStrings = 0;
local $Strings = 0;
local $CompleteTotal = 0;
while (($key,$val) = each(%stab)) {
return if $DB::signal;
next if @vars && !grep( matchvar($key, $_), @vars );
if ($usageOnly) {
globUsage(\$val, $key)
if ($package ne 'dumpvar' or $key ne 'stab')
and ref(\$val) eq 'GLOB';
} else {
dumpglob(0,$key, $val, 0, $m);
}
for my $key (keys %stab) {
my $val = $stab{$key};
return if $DB::signal;
next if @vars && !grep( matchvar($key, $_), @vars );
if ($usageOnly) {
if (
($package ne 'dumpvar' or $key ne 'stab')
and
(ref(\$val) eq 'GLOB')
) {
globUsage(\$val, $key)
}
}
else {
dumpglob(0,$key, $val, 0, $m);
}
}
if ($usageOnly) {
print "String space: $TotalStrings bytes in $Strings strings.\n";
$CompleteTotal += $TotalStrings;
print "Grand total = $CompleteTotal bytes (1 level deep) + overhead.\n";
print "String space: $TotalStrings bytes in $Strings strings.\n";
$CompleteTotal += $TotalStrings;
print "Grand total = $CompleteTotal bytes (1 level deep) + overhead.\n";
}
}

Expand Down
40 changes: 40 additions & 0 deletions lib/perl5db.t
Original file line number Diff line number Diff line change
Expand Up @@ -3662,6 +3662,46 @@ EOS
$wrapper->contents_like(qr/print "2\\n"/, "break immediately after defining problem");
}

{
# gh #23663 (variant 1)
my $wrapper = DebugWrap->new(
{
cmds =>
[
'b 4',
'X',
'c',
'q',
],
prog => '../lib/perl5db/t/gh-23663',
}
);

$wrapper->contents_unlike(
qr/Use of each\(\) on hash after insertion without resetting hash iterator results in undefined behavior/,
q/gh-23663: 'X' command does not warn about undefined behavior/,
);

# gh #23663 (variant 2)
$wrapper = DebugWrap->new(
{
cmds =>
[
'b 4',
'v main',
'c',
'q',
],
prog => '../lib/perl5db/t/gh-23663',
}
);

$wrapper->contents_unlike(
qr/Use of each\(\) on hash after insertion without resetting hash iterator results in undefined behavior/,
q/gh-23663: 'V main' command does not warn about undefined behavior/,
);
}

done_testing();

END {
Expand Down
4 changes: 4 additions & 0 deletions lib/perl5db/t/gh-23663
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Issue: https://github.com/Perl/perl5/issues/23663
# Pull Request: https://github.com/Perl/perl5/issues/23669

my $foo = "bar";
Loading