File tree Expand file tree Collapse file tree 2 files changed +55
-12
lines changed Expand file tree Collapse file tree 2 files changed +55
-12
lines changed Original file line number Diff line number Diff line change @@ -6273,13 +6273,23 @@ sub postponed_sub {
6273
6273
6274
6274
# find_sub's value is 'fullpath-filename:start-stop'. It's
6275
6275
# possible that the filename might have colons in it too.
6276
- my ( $file , $i ) = ( find_sub($subname ) =~ / ^(.*):(\d +)-.*$ / );
6276
+ my ($file , $i );
6277
+ local $\ = ' ' ;
6278
+ if ( $offset =~ / ^\+ ?0$ / ) {
6279
+ ( $file , $i ) = eval { subroutine_first_breakable_line($subname ) }
6280
+ or print $OUT $@ ;
6281
+ }
6282
+ else {
6283
+ if (( $file , $i ) = ( find_sub($subname ) =~ / ^(.*):(\d +)-.*$ / )) {
6284
+ # We got the start line. Add the offset '+<n>' from
6285
+ # $postponed{subname}.
6286
+ $i += $offset ;
6287
+ }
6288
+ else {
6289
+ print $OUT " Subroutine $subname not found.\n " ;
6290
+ }
6291
+ }
6277
6292
if ($i ) {
6278
-
6279
- # We got the start line. Add the offset '+<n>' from
6280
- # $postponed{subname}.
6281
- $i += $offset ;
6282
-
6283
6293
# Switch to the file this sub is in, temporarily.
6284
6294
local *dbline = $main ::{ ' _<' . $file };
6285
6295
@@ -6298,13 +6308,9 @@ sub postponed_sub {
6298
6308
6299
6309
# Copy the breakpoint in and delete it from %postponed.
6300
6310
$dbline {$i } = delete $postponed {$subname };
6301
- } # # end if ($i)
6302
6311
6303
- # find_sub didn't find the sub.
6304
- else {
6305
- local $\ = ' ' ;
6306
- print $OUT " Subroutine $subname not found.\n " ;
6307
- }
6312
+ _set_breakpoint_enabled_status($file , $i , 1);
6313
+ } # # end if ($i)
6308
6314
return ;
6309
6315
} # # end if ($postponed{$subname...
6310
6316
elsif ( $postponed {$subname } eq ' compile' ) { $signal = 1 }
Original file line number Diff line number Diff line change @@ -3565,6 +3565,43 @@ EOS
3565
3565
$wrapper -> contents_like(qr / Cannot break on XSUB B::svref_2object/ , " can't break on XSUB" );
3566
3566
}
3567
3567
3568
+ {
3569
+ my $wrapper = DebugWrap-> new(
3570
+ {
3571
+ cmds =>
3572
+ [
3573
+ " b problem" , # should fail
3574
+ " b postpone problem" ,
3575
+ " L" ,
3576
+ " c" ,
3577
+ " q"
3578
+ ],
3579
+ prog => \<<'EOS'
3580
+ print "1\n";
3581
+ eval <<'EOC';
3582
+ sub problem {
3583
+ $SIG{__DIE__} = sub {
3584
+ die "<b problem> will set a break point here.\n";
3585
+ }; # The break point _should_ be set here.
3586
+ warn "This line will run even if you enter <c problem>.\n";
3587
+ }
3588
+ EOC
3589
+ print "2\n";
3590
+ problem();
3591
+ print "3\n";
3592
+ EOS
3593
+ }
3594
+ );
3595
+ $wrapper -> contents_like(qr / Subroutine main::problem not found/ ,
3596
+ " problem not defined yet" );
3597
+ $wrapper -> contents_like(qr / Postponed\ breakpoints\ in\ subroutines:
3598
+ \s +main::problem\s +break\s\+ 0\s if\s 1/ x ,
3599
+ " check postponed breakpoint present" );
3600
+ $wrapper -> contents_like(qr / The break point _should_/ , " break at right place (c)" );
3601
+ $wrapper -> output_unlike(qr / This line will run even if you enter <c problem>\. / ,
3602
+ " didn't run the wrong code" );
3603
+ }
3604
+
3568
3605
done_testing();
3569
3606
3570
3607
END {
You can’t perform that action at this time.
0 commit comments