How to step over a line in the debugger?

Discussion in 'Perl Misc' started by Sysadmin, May 23, 2005.

  1. Sysadmin

    Sysadmin Guest

    Hi everyone,

    I just found myself needing to use the debugger to sort out a problem in one of
    my administrative scripts, and I realized I needed a feature that seems obvious
    enough for a debugger, but I can't find it mentioned in perldebug or the Camel.
    Is it possible to step over an arbitrary line of code, without executing it?

    Let's say I have a script with simple example code like this:
    print "Line 1.\n";
    print "Line 2.\n";
    print "Line 3.\n";

    What must I do to execute line 1 and 3, but not line 2, inside the debugger?

    If I load the debugger and enter one s command to execute line 1, what do I
    enter to skip the next line and go directly to the one following it?

    I'm not a programmer by training, if this is obvious then please enlighten me.
    :)


    --
    Sysadmin
     
    Sysadmin, May 23, 2005
    #1
    1. Advertising

  2. Sysadmin

    Peter Scott Guest

    On Mon, 23 May 2005 03:17:10 -0700, Sysadmin wrote:
    > Hi everyone,
    >
    > I just found myself needing to use the debugger to sort out a problem in one of
    > my administrative scripts, and I realized I needed a feature that seems obvious
    > enough for a debugger, but I can't find it mentioned in perldebug or the Camel.
    > Is it possible to step over an arbitrary line of code, without executing it?


    No. The debugger is not directing the execution of your program, it is
    observing it. All you can do is vary the places it stops to report what's
    happening.

    > Let's say I have a script with simple example code like this:
    > print "Line 1.\n";
    > print "Line 2.\n";
    > print "Line 3.\n";
    >
    > What must I do to execute line 1 and 3, but not line 2, inside the debugger?


    If line 2 contained a conditional, e.g.

    print "Line 2.\n" if $foo;

    you could set $foo to false in the debugger before reaching the line.
    That's about it.

    --
    Peter Scott
    http://www.perlmedic.com/
    http://www.perldebugged.com/
     
    Peter Scott, May 23, 2005
    #2
    1. Advertising

  3. Sysadmin

    Sysadmin Guest

    In article <>, Peter Scott says...
    >> Is it possible to step over an arbitrary line of code, without
    >> executing it?


    > No. The debugger is not directing the execution of your program,
    > it is observing it. All you can do is vary the places it stops
    > to report what's happening.


    :(

    >> Let's say I have a script with simple example code like this:
    >> print "Line 1.\n";
    >> print "Line 2.\n";
    >> print "Line 3.\n";


    >> What must I do to execute line 1 and 3, but not line 2, inside
    >> the debugger?


    > If line 2 contained a conditional, e.g.


    > print "Line 2.\n" if $foo;


    > you could set $foo to false in the debugger before reaching
    > the line.
    > That's about it.


    Amazing, even VB6 can do it, but not perl.
    I never thought I'd be lacking a feature in the debugger.

    Oh well, thanks for answering!

    > http://www.perldebugged.com/


    Huh, is that from 2002, how have I managed to miss that title for so long? :)

    --
    Sysadmin
     
    Sysadmin, May 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jaap de verwant slachter
    Replies:
    0
    Views:
    1,269
    jaap de verwant slachter
    Jul 1, 2003
  2. Robin Mark Tucker

    Debugging - can step over, but not step into.....

    Robin Mark Tucker, Jun 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    790
    Robin Mark Tucker
    Jun 5, 2006
  3. Sam Roberts
    Replies:
    0
    Views:
    147
    Sam Roberts
    Jan 31, 2005
  4. Sam Roberts
    Replies:
    0
    Views:
    91
    Sam Roberts
    Mar 3, 2005
  5. Robert Oschler
    Replies:
    1
    Views:
    225
    Mcginkel
    Sep 5, 2005
Loading...

Share This Page