Open p5pRT opened 7 years ago
Debugger does not stop at postponed breakpoints in perl 5.20
Same behavior in perl5.20 from Debian 8 as perl 5.20 built from source. No customizations to PERL5DB.
http://www.perlmonks.com/?node_id=1176116
% perl -dwe0
main::(-e:1): 0 DB\<1> b File::Temp->new Subroutine File::Temp not found.
DB\<2> b postpone File::Temp::new DB\<3> use File::Temp DB\<4> x File::Temp->new 0 File::Temp=GLOB(0x283db48) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<5> b postpone File::Temp::new DB\<6> x File::Temp->new 0 File::Temp=GLOB(0x216aa78) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<7> B * Deleting all breakpoints... DB\<8> b postpone File::Temp::new DB\<9> x File::Temp->new 0 File::Temp=GLOB(0x216abc8) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<10> b File::Temp::new DB\<11> x File::Temp->new File::Temp::new(/.../x86_64/perl/perl-5.20.2-mw-014/lib/5.20.2/File/Temp.pm:885): 885: my $proto = shift; DB\<\<12>> c 0 File::Temp=GLOB(0x216aeb0) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### STOPPED at File::Temp::new as EXPECTED
On Fri\, 16 Dec 2016 18:33:04 GMT\, jkahrman@mathworks.com wrote:
This is a bug report for perl from jkahrman@mathworks.com\, generated with the help of perlbug 1.40 running under perl 5.20.2.
----------------------------------------------------------------- [Please describe your issue here]
Debugger does not stop at postponed breakpoints in perl 5.20
Same behavior in perl5.20 from Debian 8 as perl 5.20 built from source. No customizations to PERL5DB.
http://www.perlmonks.com/?node_id=1176116
% perl -dwe0
main::(-e:1): 0 DB\<1> b File::Temp->new Subroutine File::Temp not found.
DB\<2> b postpone File::Temp::new DB\<3> use File::Temp DB\<4> x File::Temp->new 0 File::Temp=GLOB(0x283db48) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<5> b postpone File::Temp::new DB\<6> x File::Temp->new 0 File::Temp=GLOB(0x216aa78) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<7> B * Deleting all breakpoints... DB\<8> b postpone File::Temp::new DB\<9> x File::Temp->new 0 File::Temp=GLOB(0x216abc8) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### UNEXPECTEDLY did not stop at File::Temp::new
DB\<10> b File::Temp::new DB\<11> x File::Temp->new File::Temp::new(/.../x86_64/perl/perl-5.20.2-mw- 014/lib/5.20.2/File/Temp.pm:885): 885: my $proto = shift; DB\<\<12>> c 0 File::Temp=GLOB(0x216aeb0) -> *File::Temp::$fh FileHandle({*File::Temp::$fh}) => fileno(3)
########### STOPPED at File::Temp::new as EXPECTED
Confirmed that problem exists in 5.24.0 as well.
-- James E Keenan (jkeenan@cpan.org)
The RT System itself - Status changed from 'new' to 'open'
A co-worker had some time to investigate the issue and sent me the following. I haven't yet had time to investigate further.
I think it may need this:
--- perl-5.20.2/lib/5.20.2/perl5db.pl 2016-12-01 17:08:48.088626441 -0500 +++ perl5db.pl 2017-01-18 12:07:29.552135518 -0500 @@ -6204\,6 +6204\,7 @@
# Copy the breakpoint in and delete it from %postponed.
$dbline{$i} = delete $postponed{$subname};
+ _set_breakpoint_enabled_status($file\, $i\, 1);
} ## end if ($i)
# find_sub didn't find the sub.
With some printf-style debugging it seems the built-in DB::postponed() hook (described in perldebguts) is getting hit when the file is compiled\, and the area of the code above is attempting to set the breakpoint. But then when DB::DB() is hit for that line\, DB::_DB__determine_if_we_should_break() says "nope" because _is_breakpoint_enabled($filename\, $line) said it was not enabled.
This enabled-ness is implemented in $breakpoints_data{$filename}{$line}{enabled} = $bool. I suspect this is a new thing\, and someone forgot to check whether new breakpoints were also being enabled everywhere they are being set.
Which makes me wonder if this problem will show up in other constructs...
After further testing of the postponed feature with the fix and comparing to 5.8.8 behavior\, I seem to have made a mistake in my recording of the expected behavior.
While postponed breakpoints ARE broken in (at least) 5.20 and later\, I was under the impression that they behaved like regular breakpoints when the file was already loaded. They do not\, even in 5.8.8.
So while my first test case IS a regression\, my second and third test cases are not.
After further testing of the postponed feature with the fix and comparing to 5.8.8 behavior\, I seem to have made a mistake in my recording of the expected behavior.
While postponed breakpoints ARE broken in (at least) 5.20 and later\, I was under the impression that they behaved like regular breakpoints when the file was already loaded. They do not\, even in 5.8.8.
So while my first test case IS a regression\, my second and third test cases are not.
Migrated from rt.perl.org#130361 (status was 'open')
Searchable as RT130361$