Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Debugger line numbering anomaly

by haukex (Chancellor)
on Dec 25, 2019 at 20:41 UTC ( #11110616=note: print w/replies, xml ) Need Help??


in reply to Debugger line numbering anomaly

Bisecting this was a bit tricky, but the results are that the regression was accidentally introduced in 6432a58, reported as RT#131930, and fixed in 823ba44 - the bug should therefore only exist in Perl releases v5.26.*.

#!/usr/bin/env perl use warnings; use strict; use Data::Dumper; $Data::Dumper::Useqq=1; # Run from the perl5 source tree: # $ ./Porting/bisect.pl --start=v5.24.0 --end=v5.26.3 -- + ./perl -Ilib /path/to/this.pl # => 6432a58ad9a504c2dc834eb0d131a10b4b6c886b # $ ./Porting/bisect.pl --start=v5.26.0 --end=v5.28.2 --expect-fail -- + ./perl -Ilib /path/to/this.pl # => 823ba440369100de3f2693420a3887a645a57d28 open my $ofh, '>', '/tmp/testdb.pl' or die $!; print $ofh <<'END_SCRIPT'; #!/bin/perl -w use strict; $_ = shift // ''; # line 3 s{a([bc])} # 4 {d$1}g; # 5 print; # 6 END_SCRIPT close $ofh; unlink('/tmp/test.listing'); local $ENV{PERLDB_OPTS} = "NonStop AutoTrace LineInfo=/tmp/test.listin +g"; system($^X,'-Ilib','-d','/tmp/testdb.pl')==0 or die "\$?=$?"; my $o = do { open my $fh, '<', '/tmp/test.listing' or die $!; local $/ +; <$fh> }; my $x = $o =~ /^main::\([^)]+\.pl:5\):\s+{d\$1}g;\s+#\s+5\s*$/m; # goo +d my $y = $o =~ /^main::\([^)]+\.pl:6\):\s+print;\s+#\s+6\s*$/m; # goo +d my $z = $o =~ /^main::\([^)]+\.pl:5\):\s+print;\s+#\s+6\s*$/m; # bad if ( $x && $y && !$z ) { print "GOOD\n"; exit 0; } elsif ( !$x && !$y && $z ) { print "BAD\n"; exit 1; } else { print STDERR Dumper($o,$x,$y,$z); die "What?"; }

Replies are listed 'Best First'.
Re^2: Debugger line numbering anomaly (updated)
by LanX (Archbishop) on Dec 25, 2019 at 21:02 UTC
    > reported as RT#131930

    Thanks, the bug report shows that __LINE__ gets confused while parsing and compiling the code, which is not the fault of the debugger.

    Of course a warn in the test script would have demonstrated the wrong __LINE__ too.

    update

    > Bisecting this was a bit tricky,

    well, with help of the warn statements hinting to __LINE__, it would have been much easier.

    update

    turns out that the git on my win-box runs under v5.26, and it's easily demonstrated there:

    $ perl -v This is perl 5, version 26, subversion 2 (v5.26.2) built for x86_64-ms +ys-thread-multi $ perl warn "before"; s(x) (y); warn "after"; __END__ before at - line 1. after at - line 3. $ perl warn "before"; s/x/y/; warn "after"; __END__ before at - line 1. after at - line 3. $ perl -MO=Concise warn "before"; s(x) (y); warn "after"; __END__ d <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -:1) v:{ ->3 5 <@> warn[t1] vK/1 ->6 3 <0> pushmark s ->4 4 <$> const[PV "before"] s ->5 6 <;> nextstate(main 1 -:2) v:{ ->7 8 </> subst(/"x"/) vK ->9 7 <$> const[PV "y"] s ->8 9 <;> nextstate(main 1 -:3) v:{ ->a # should be :4 not :3 c <@> warn[t2] vK/1 ->d a <0> pushmark s ->b b <$> const[PV "after"] s ->c - syntax OK

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110616]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2020-05-27 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (155 votes). Check out past polls.

    Notices?