Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: I never use the debugger.

by Anonymous Monk
on Jul 27, 2005 at 11:36 UTC ( [id://478558]=note: print w/replies, xml ) Need Help??


in reply to Re: I never use the debugger.
in thread I never use the debugger.

I use print statements because that'll save me time stepping through code, setting breakpoints, etc.

I'm often interested in the value of a variable after a few thousand iterations in a loop. I really don't want to step through that code, or set a breakpoint in that loop. Takes way too much time.

Replies are listed 'Best First'.
Re^3: I never use the debugger.
by Anonymous Monk on Jul 27, 2005 at 21:43 UTC
    There's nothing to say you can't do a hybrid approach if you're debugger is being annoying... which the perl debugger is sometimes. :-(

    Add a debugging conditional for the nth line of the loop, and set a breakpoint at it.

    In my experience, though, if I'm interested in the thousandth interation of something, there's something happening (a particular record, or database entry, or something) that triggers my interest in the 1,000th time through the loop versus the 999th time.

    If I can identify what that is, I can write debug code to detect the suspicious condition, and set a breakpoint for that. Then I can decide what to print out, and where to investigate from there.

    Unfortunately, the perl debugger doesn't seem to have a "detect this condition and break" function, and I sure wish it did. I consider it a flaw in the debugger when I have to write debug code by hand, but it's better than writing *all* the debug code by hand, only to tear it *all* out later...

      Hmmm?

      b My::App::some_function $_[3] > 999
      Sets the breakpoint on My::App::some_function only if the 4th argument is numerically larger than 999. Similar structure for line breaks:
      b 215 $i > 999
      I use it all the time. It's invaluable.

        The documentation on that feature has changed: it used to read "b <linenumber> <expr>", and no matter what I tried, the debugger wouldn't stop, not even with b <linenumber> 1, so I gave up on it years ago.

        You're saying it's a stable, reliable feature now? A debugger feature that doesn't work is worse than none, really...

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-03-28 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found