How to save state while debugging?

Discussion in 'Perl Misc' started by bill, Nov 20, 2003.

  1. bill

    bill Guest

    Sometimes, the bug one is trying to figure out doesn't come up
    until a long time after the start of the program's execution. This
    can make the debugging extremely time-consuming. In such, it would
    be nice to be able to save the program's state shortly before the
    bug appears, so that subsequent debugging cycles can re-start from
    the saved state, without having to go back all the way to the
    beginning. Is there a way to do this in perldb? If not, are there
    any Perl debuggers that have this feature?

    Thanks!

    bill
     
    bill, Nov 20, 2003
    #1
    1. Advertising

  2. bill

    Peter Scott Guest

    In article <bpj51e$o5q$>,
    bill <> writes:
    >Sometimes, the bug one is trying to figure out doesn't come up
    >until a long time after the start of the program's execution. This
    >can make the debugging extremely time-consuming. In such, it would
    >be nice to be able to save the program's state shortly before the
    >bug appears, so that subsequent debugging cycles can re-start from
    >the saved state, without having to go back all the way to the
    >beginning. Is there a way to do this in perldb? If not, are there
    >any Perl debuggers that have this feature?


    For what you describe the best option is to figure out an
    appropriate breakpoint or two. After one or two initial runs
    through, you get an idea of what might precede the bug and can
    set a breakpoint for that spot. The following features of
    the debugger are worth learning in this respect: deferred
    breakpoints (b postpone), conditional breakpoints, watchpoints,
    and actions.

    --
    Peter Scott
    http://www.perldebugged.com/
    *** NEW *** http//www.perlmedic.com/
     
    Peter Scott, Nov 21, 2003
    #2
    1. Advertising

  3. bill

    Ben Morrow Guest

    wrote:
    > In article <bpj51e$o5q$>,
    > bill <> writes:
    > >Sometimes, the bug one is trying to figure out doesn't come up
    > >until a long time after the start of the program's execution. This
    > >can make the debugging extremely time-consuming. In such, it would
    > >be nice to be able to save the program's state shortly before the
    > >bug appears, so that subsequent debugging cycles can re-start from
    > >the saved state, without having to go back all the way to the
    > >beginning. Is there a way to do this in perldb? If not, are there
    > >any Perl debuggers that have this feature?

    >
    > For what you describe the best option is to figure out an
    > appropriate breakpoint or two. After one or two initial runs
    > through, you get an idea of what might precede the bug and can
    > set a breakpoint for that spot.


    The trouble with this approach is that it doesn't help if the program
    takes a long time to reach the breakpoint even when running
    uninterruptedly.

    The usual answer to this is to start breaking your code up into
    smaller test-cases, until you isolate the problem.

    Ben

    --
    For the last month, a large number of PSNs in the Arpa[Inter-]net have been
    reporting symptoms of congestion ... These reports have been accompanied by an
    increasing number of user complaints ... As of June,... the Arpanet contained
    47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
     
    Ben Morrow, Nov 21, 2003
    #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. ^CrazyCoder^
    Replies:
    3
    Views:
    7,278
    Terrence Benade
    Sep 15, 2003
  2. user
    Replies:
    1
    Views:
    775
    Bruce Barker
    Apr 4, 2005
  3. teo
    Replies:
    1
    Views:
    472
  4. BusyBoy
    Replies:
    2
    Views:
    612
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Oct 31, 2006
  5. subhadip
    Replies:
    0
    Views:
    647
    subhadip
    Mar 28, 2007
Loading...

Share This Page