RE: Q: How best to detect running inside the debugger

2004-11-01 Thread Tim Meadowcroft
 
Peter Scott wrote:
> > What's the best/recommended way for a script to detect when it's 
> > running under the debugger ?
> 
> I usually do
> 
> ... if defined &DB::DB
> 
> for the prettiness of it.

Thanks - that looks like a much better test.

--
Tim



Re: Q: How best to detect running inside the debugger

2004-10-31 Thread Peter Scott
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Tim Meadowcroft) writes:
>What's the best/recommended way for a script to detect when it's running
>under the debugger ?

I usually do

... if defined &DB::DB

for the prettiness of it.

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


Q: How best to detect running inside the debugger

2004-10-29 Thread Tim Meadowcroft

Hi all,

I've searched various FAQ's, perldocs and the archive of the list, but
can't find any mention of this, so thought this list might be a good
source of advice.

What's the best/recommended way for a script to detect when it's running
under the debugger ?

I know you shouldn't need to know, but sometimes you do need to - in
this example I have a script that uses fork() on Win32 which the
debugger doesn't seem to enjoy (given that fork() on Win32 is an
emulated hack), so if I'm running in the debugger then it runs what
would be the child process synchronously.

So far I'm using

 # detect if we're running in the perl debugger - so far the test is a
hack !
 sub InDebugger
 {
return exists($ENV{PERLDB_PIDS});
 }

which works, is cheap, and should be reasonably robust, but I was
wondering if there was a better way, something more stable to look for -
I could look for various namespaces existing but that seems a bit weak.

Cheers

--
Tim