-
Notifications
You must be signed in to change notification settings - Fork 602
Closed
Labels
Description
Module: Perl debugger (core_perl)
Description
When attempting to do data examination with the X command or V main reports undefined behavior.
Use of each() on hash after insertion without resetting hash iterator results in undefined behavior, Perl interpreter: 0x55a84e5f5010 at /usr/share/perl5/core_perl/dumpvar.pl line 488.
at /usr/share/perl5/core_perl/dumpvar.pl line 488.
main::dumpvar("main", -1) called at /usr/share/perl5/core_perl/perl5db.pl line 3801
eval {...} called at /usr/share/perl5/core_perl/perl5db.pl line 3796
DB::Obj::_handle_V_command_and_X_command(DB::Obj=HASH(0x55a84e624750)) called at /usr/share/perl5/core_perl/perl5db.pl line 3175
DB::DB called at main.pl line 4
Steps to Reproduce
- Create a minimal script.
# file: example.pl
my $foo = "bar";
- Start the debugger with
perl -d example.pl. - Enter the
Xcommand (orV main). - Peruse the output for a line that reports undefined behavoir
Use of each() on hash after insertion without resetting hash iterator results in undefined behavior, Perl interpreter: 0x55eff1ca2010 at /usr/share/perl5/core_perl/dumpvar.pl line 488.
at /usr/share/perl5/core_perl/dumpvar.pl line 488.
main::dumpvar("main", -1) called at /usr/share/perl5/core_perl/perl5db.pl line 3801
eval {...} called at /usr/share/perl5/core_perl/perl5db.pl line 3796
DB::Obj::_handle_V_command_and_X_command(DB::Obj=HASH(0x55eff1cd16f0)) called at /usr/share/perl5/core_perl/perl5db.pl line 3175
DB::DB called at example.pl line 2
This can be reproduced with other files as well.
# file: example2.pl
use strict;
sub foo {
my $p1 = shift;
print $p1, "\n";
}
foo('hello');
The above sample with the same steps results in a very similar error message:
Use of each() on hash after insertion without resetting hash iterator results in undefined behavior, Perl interpreter: 0x5563db0de010 at /usr/share/perl5/core_perl/dumpvar.pl line 488.
at /usr/share/perl5/core_perl/dumpvar.pl line 488.
main::dumpvar("main", -1) called at /usr/share/perl5/core_perl/perl5db.pl line 3801
eval {...} called at /usr/share/perl5/core_perl/perl5db.pl line 3796
DB::Obj::_handle_V_command_and_X_command(DB::Obj=HASH(0x5563db10d790)) called at /usr/share/perl5/core_perl/perl5db.pl line 3175
DB::DB called at example2.pl line 9
Expected behavior
I would like the data examination functions in the debugger not to trigger any undefined behavior.
Perl configuration
This is perl 5, version 42, subversion 0 (v5.42.0) built for x86_64-linux-thread-multi
Copyright 1987-2025, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.