Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Debugging a program

by hexcoder (Chaplain)
on Aug 06, 2008 at 17:22 UTC ( #702691=note: print w/replies, xml ) Need Help??


in reply to Re^2: Debugging a program
in thread Debugging a program

Thanks, that saves the action of setting a breakpoint.

But even better, I could shift the signal handler code into the debugger initialization file .perldb. Then I do not have to modify the original source code. Works great!

This is the content of file .perldb (place it in the current or in the home directory):

sub afterinit { $::SIG{'__WARN__'} = sub { my $warning = shift; if ( $warning =~ m{\s at \s \S+ \s line \s \d+ \. $}xms ) { $DB::single = 1; # debugger stops here automatically } warn $warning; }; print "sigwarn handler installed!\n"; return; }

Replies are listed 'Best First'.
Re^4: Debugging a program
by hexcoder (Chaplain) on Jul 18, 2016 at 11:59 UTC
    Addition
    ... and under Windows save it to file perldb.ini in your %HOMEDRIVE%%HOMEPATH% directory.

    Then make sure to set the file attributes to read-only. That way it is safe and the debugger is happy.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://702691]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2016-12-09 13:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (151 votes). Check out past polls.