Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

•Re: No Pause on Elsif in Debugger

by merlyn (Sage)
on Jul 22, 2004 at 22:47 UTC ( #376748=note: print w/ replies, xml ) Need Help??


in reply to No Pause on Elsif in Debugger

It "pauses" on the beginning of a statement. elsif is not the beginning of a statement.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


Comment on •Re: No Pause on Elsif in Debugger
Re^2: No Pause on Elsif in Debugger
by QM (Vicar) on Jul 23, 2004 at 13:07 UTC
    It "pauses" on the beginning of a statement. elsif is not the beginning of a statement.
    Is that DWIM? What behavior do we want?

    I expect that it will at least pause on the evaluation of interesting conditionals [elsif (0) being an example of an uninteresting one]

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

      It doesn't really matter if that's exactly what you want. It would take a major overhaul (major) of the interface between the execution engine and the debugger Perl code to get it to do anything else. It's a very fundamental design choice. It's just like you can't set a breakpoint to see the "middle" of a map operation, other than at a statement boundary in a called subroutine.

      The debugger gets notified only as each statement is entered. That's it.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Any chance of getting a nice little discussion about this decision, or a point to the design discussion? The historian in me is looking for new material.

        -QM
        --
        There are only 11 people in the world. Those who understand unary, and those who don't.

      Of course, the Right Place to put the breakpoints is on the code *inside* the if/elsif/else - "right" being "you will actually stop somewhere near where you want to be". I've noticed similar annoying behavior with for loops at times. Just set your breakpoints inside and the problem goes away. This is the least intrusive solution; obviously, you can code to the debugger's limitations by doing things like
      if ($cond1) { ... } else { if ($cond2) { ... } else { if ($cond3) { .. } } }
      and now you can break at every if. (That looks scarily like some of my old PL/1 programs...)
        I started to say
        If I have a long if/elsif/elsif/... chain, then setting breakpoints inside every block is painful (especially when repeating the same breakpoints while doing the debug/edit loop).
        However, more than 3 is a good indicator I'm doing something wrong, and should rethink my attack.

        -QM
        --
        Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-10-25 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (148 votes), past polls