How to save state while debugging?

B

bill

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
 
P

Peter Scott

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.
 
B

Ben Morrow

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top