Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Is it possible to invoke the debugger from within a program

Reply
Thread Tools

Is it possible to invoke the debugger from within a program

 
 
Bruce Horrocks
Guest
Posts: n/a
 
      03-06-2006
If I run a program with -d and then use c to continue running, is there
a way to have the program drop into the debugger at the appropriate line
when a run-time warning is displayed?

(This would help hugely because I'm effectively debugging the input data
rather than the program and the warnings can arise at multiple points.
Putting all these points into the necessary 'b <cond>' commands and
editing them every time the line numbering changes as the program is
modified is proving to be a chore.)

Regards,
--
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email
 
Reply With Quote
 
 
 
 
Paul Lalli
Guest
Posts: n/a
 
      03-06-2006
Bruce Horrocks wrote:
> If I run a program with -d and then use c to continue running, is there
> a way to have the program drop into the debugger at the appropriate line
> when a run-time warning is displayed?


Set a warn handler in your code to execute the statement that tells the
debugger to pause (read the perldebug page for more info).

Basically, add this block to your code:
$SIG{__WARN__} = sub {
warn @_;
$DB::single = 1;
};

You may wish to put that in a BEGIN block if you want to capture
compile-time warnings as well.

Paul Lalli

 
Reply With Quote
 
 
 
 
Bruce Horrocks
Guest
Posts: n/a
 
      03-06-2006
In message <(E-Mail Removed) .com>, Paul
Lalli <(E-Mail Removed)> writes
>Set a warn handler in your code to execute the statement that tells the
>debugger to pause (read the perldebug page for more info).


Thank-you very much Paul. It's obvious now I know what to look for.


--
Bruce Horrocks
Surrey
England
<firstname>@<surname>.plus.com -- fix the obvious for email
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help getting a debugger going for IE - any free debugger aflat362 Javascript 7 12-07-2006 10:51 PM
invoke system command from within a method Moritz Reiter Ruby 8 11-24-2006 04:20 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Is it possible to invoke a .NET library as a com Component from within ASP? Jorge Luzarraga Castro ASP .Net 1 11-07-2005 08:51 PM
Neither IE-Debugger or Mozilla/Venkman debugger can step through dynamically added code? Robert Oschler Javascript 1 09-05-2005 07:17 AM



Advertisments