Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Debugger line numbering anomaly

by LanX (Sage)
on Dec 24, 2019 at 10:24 UTC ( #11110581=note: print w/replies, xml ) Need Help??


in reply to Debugger line numbering anomaly

Looks good to me
DB<3> l 1-6 1 #!/bin/perl -w 2: use strict; 3==> $_ = shift // ''; # line 3 4: s{a([bc])} # 4 5 {d$1}g; # 5 6: print; # 6 DB<4>

You can't break at 5 though, because the multi-line statement starts at 4.

Semicolons matter!

Edit

Please try recreating the file and test again.

$ cat db_tst.pl #!/bin/perl -w use strict; $_ = shift // ''; # line 3 s{a([bc])} # 4 {d$1}g; # 5 print; # 6

Do you probably have a weird line ending (from windows?) after the shebang?

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

Replies are listed 'Best First'.
Re^2: Debugger line numbering anomaly
by lzipin (Acolyte) on Dec 24, 2019 at 19:22 UTC

    In the test code, lines 4 and 5 comprise a substitution operator. With delimiter pairs for the match and replace clauses, the operator allows whitespace between the clauses (with the single ';' terminating the operator on line 5). And, in fact, the code runs in the debugger (and without the debugger) just fine. It's just the debugger that, it seems, isn't parsing the line, and mis-numbering subsequent lines.

    I tried again on a Debian Linux, with Perl 5.28.1 and perl5db.pl 1.5.3. It doesn't show the problem. Maybe that's a clue: I can compare perl5db.pl code from the two machines. I'll report back.

      again:
      • is the problem reproducible if you copy the code from this thread?
      • did you include warn to see if the compilation recorded the right line-numbers?
      and
      • can you narrow down which code-line is starting the problem?
      update

      There are internal arrays which hold all parsed lines of the debugger, you could check there if the debugger got it right.

      perldebguts :

      Each array @{"_<$filename"} holds the lines of $filename for a file compiled by Perl.

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

        First, I compared (in the programmer's text editor Epsilon) perl5db.pl v 1.5.1 and 1.5.3. Only a few differences; none seems significant to this issue.

        So I copied the 1.5.3 version to /usr/share/perl/5.26/perl5db.pl on the Xubuntu machine. Same (wrong) debug behavior as with the original 1.5.1 version. Further, the debug command "x @{$main::{'_<t6.pl'}}" is also missing the (original) line 5. This suggests (so far) that it's a Perl 5.26 bug, and not a perl5db.pl bug.

        Still exploring ...

        -- Lee

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2022-05-22 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?