Skip Menu |
Report information
Id: 132653
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: kes-kes [at] yandex.ru
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: Wishlist
Type: debugger
Perl Version: (no value)
Fixed In: (no value)



Date: Mon, 25 Dec 2017 11:18:15 +0200
To: perlbug <perlbug [...] perl.org>
From: KES <kes-kes [...] yandex.ru>
Subject: Step-by-step debugging do not work for if elsif elsif
Download (untitled) / with headers
text/plain 807b
Very often in the program there are consecutive ifs. Like this: $x = <>; if( !$x ) { print 1; } elsif( $x eq 'asdf' ) { print 2; } elsif( $x ne 'asdf' ) { print 3; } else { print 4; } And this is unhandy when 's' debugger command skip all ifs and do not stop on each. For example 'elsif' is skipped on line 8: $ perl -d ./t.pl Loading DB routines from perl5db.pl version 1.49_04 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(./t.pl:3): $x = <>; DB<1> s df main::(./t.pl:5): if( !$x ) { DB<1> s main::(./t.pl:12): print 3; DB<1> expected debugging: main::(./t.pl:3): $x = <>; DB<1> s df main::(./t.pl:5): if( !$x ) { DB<1> s main::(./t.pl:8): elsif( $x eq 'asdf' ) { DB<1> s main::(./t.pl:12): print 3; DB<1>
To: perl5-porters [...] perl.org
Date: Thu, 28 Dec 2017 11:59:31 +0000
From: Dave Mitchell <davem [...] iabyn.com>
Subject: Re: [perl #132653] Step-by-step debugging do not work for if elsif elsif
Download (untitled) / with headers
text/plain 1.7k
On Mon, Dec 25, 2017 at 01:19:59AM -0800, KES wrote: Show quoted text
> # New Ticket Created by KES > # Please include the string: [perl #132653] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=132653 > > > > Very often in the program there are consecutive ifs. Like this: > > $x = <>; > > if( !$x ) { > print 1; > } > elsif( $x eq 'asdf' ) { > print 2; > } > elsif( $x ne 'asdf' ) { > print 3; > } > else { > print 4; > } > > And this is unhandy when 's' debugger command skip all ifs and do not stop on each. > For example 'elsif' is skipped on line 8: > > $ perl -d ./t.pl > > Loading DB routines from perl5db.pl version 1.49_04 > Editor support available. > > Enter h or 'h h' for help, or 'man perldebug' for more help. > > main::(./t.pl:3): $x = <>; > DB<1> s > df > main::(./t.pl:5): if( !$x ) { > DB<1> s > main::(./t.pl:12): print 3; > DB<1> > > expected debugging: > > main::(./t.pl:3): $x = <>; > DB<1> s > df > main::(./t.pl:5): if( !$x ) { > DB<1> s > main::(./t.pl:8): elsif( $x eq 'asdf' ) { > DB<1> s > main::(./t.pl:12): print 3; > DB<1>
's' is documented as: Single step. Executes until the beginning of another statement Perl compiles if/else chains into ?: expressions; for example, if (C1) { S1; } elsif (C2) { S2; } elsif (C3) { S3; } else { S4; } gets compiled to the equivalent of: C1 ? do { S1; } : C2 ? do { S2; } : C3 ? do { S3 } : do { S4 }; which the debugger sees as a single expression. -- More than any other time in history, mankind faces a crossroads. One path leads to despair and utter hopelessness. The other, to total extinction. Let us pray we have the wisdom to choose correctly. -- Woody Allen
RT-Send-CC: perl5-porters [...] perl.org
Determined not a bug. Rejecting ticket.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 181b
Show quoted text
> C1 ? do { S1; } : C2 ? do { S2; } : C3 ? do { S3 } : do { S4 }; > which the debugger sees as a single expression.
Hope this will someday be seen by debugger as a few expressions
From: Slaven Rezic <slaven [...] rezic.de>
Date: Thu, 28 Dec 2017 15:14:16 +0100
CC: perl5-porters [...] perl.org
To: "Sawyer X via RT" <perlbug-followup [...] perl.org>
Subject: Re: [perl #132653] Step-by-step debugging do not work for if elsif elsif
Download (untitled) / with headers
text/plain 344b
"Sawyer X via RT" <perlbug-followup@perl.org> writes: Show quoted text
> Determined not a bug. Rejecting ticket.
IMHO this issue is valid. The current behavior represents bad user experience. Perl's internal representation is irrelevant here. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de Berlin Perl Mongers - http://berlin.pm.org
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 496b
On Thu, 28 Dec 2017 06:14:55 -0800, slaven@rezic.de wrote: Show quoted text
> "Sawyer X via RT" <perlbug-followup@perl.org> writes: >
> > Determined not a bug. Rejecting ticket.
> > IMHO this issue is valid. The current behavior represents bad user > experience. Perl's internal representation is irrelevant here.
This can be a wishlist item for the debugger, but it is not a bug with the language. It is just the way the language is. I'm not sure it's possible to accomplish, though. Dave, what do you think?
To: "Sawyer X via RT" <perlbug-followup [...] perl.org>
CC: perl5-porters [...] perl.org
Date: Thu, 28 Dec 2017 16:31:58 +0100
Subject: Re: [perl #132653] Step-by-step debugging do not work for if elsif elsif
From: Slaven Rezic <slaven [...] rezic.de>
Download (untitled) / with headers
text/plain 1.1k
"Sawyer X via RT" <perlbug-followup@perl.org> writes: Show quoted text
> On Thu, 28 Dec 2017 06:14:55 -0800, slaven@rezic.de wrote:
>> "Sawyer X via RT" <perlbug-followup@perl.org> writes: >>
>> > Determined not a bug. Rejecting ticket.
>> >> IMHO this issue is valid. The current behavior represents bad user >> experience. Perl's internal representation is irrelevant here.
> > This can be a wishlist item for the debugger, but it is not a bug with the language. It is just the way the language is.
Whether it's called a bug, a problem, an issue or a wishlist item --- it's a something which should be addressed, and documented. If it's unfixable or too impractical to fix --- there's a "BUGS" section in perldebug.pod (or it could go into a new "LIMITATIONS" section). If it's fixable, but requires considerable effort, then it could go to todo.pod. At least this something deserves a little bit of discussion. Regards, Slaven -- Slaven Rezic - slaven <at> rezic <dot> de BBBike - route planner for cyclists in Berlin WWW version: http://www.bbbike.de Perl/Tk version for Unix and Windows: http://bbbike.sourceforge.net
Download (untitled) / with headers
text/plain 193b
Re-opening and classifying ticket as Wishlist. For the time being, a documentation patch describing the limitation would be welcome. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 272b
On Thu, 28 Dec 2017 14:49:27 -0800, jkeenan wrote: Show quoted text
> Re-opening and classifying ticket as Wishlist. For the time being, a > documentation patch describing the limitation would be welcome.
Thank you. I just opened the ticket to do the same, following Slaven's comments.
From: Dave Mitchell <davem [...] iabyn.com>
Date: Tue, 2 Jan 2018 11:44:16 +0000
To: Slaven Rezic <slaven [...] rezic.de>
CC: Sawyer X via RT <perlbug-followup [...] perl.org>, perl5-porters [...] perl.org
Subject: Re: [perl #132653] Step-by-step debugging do not work for if elsif elsif
Download (untitled) / with headers
text/plain 968b
On Thu, Dec 28, 2017 at 04:31:58PM +0100, Slaven Rezic wrote: Show quoted text
> Whether it's called a bug, a problem, an issue or a wishlist item --- > it's a something which should be addressed, and documented. If it's > unfixable or too impractical to fix --- there's a "BUGS" section in > perldebug.pod (or it could go into a new "LIMITATIONS" section). If it's > fixable, but requires considerable effort, then it could go to todo.pod. > > At least this something deserves a little bit of discussion.
My opinions: 1) It's not a bug, in that its behaving exactly as documented; 2) but it would be nice to have better behaviour; 3) but it would probably be hard to achieve that behaviour; 4) I'm not opposed to the documentation for the 's' command in the debugger to be improved to clarify what's meant by 'the next statement' (but I'm not volunteering to do it myself). -- But Pity stayed his hand. "It's a pity I've run out of bullets", he thought. -- "Bored of the Rings"


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org