Page 1 of 1

running under a debugger

Posted: Mon May 16, 2011 10:21 pm
by spacebuddy
Hi All,

Is there anyway to check if my application is running under a debugger?
:D

Re: running under a debugger

Posted: Mon May 16, 2011 11:44 pm
by WilliamL
That's a good question. I thought there was but I can't remember where I saw it.

Until somebody comes up with an answer you can use:
EnableDebugger
DisableDebugger

Anybody got an answer?

Re: running under a debugger

Posted: Mon May 16, 2011 11:51 pm
by Demivec

Code: Select all

CompilerIf #PB_Compiler_Debugger 
  ;do your debugger based code changes here, or set a variable such as 'usingDebugger = 1'
CompilerElse
  ;do your non-debugger code here
CompilerEndif

Re: running under a debugger

Posted: Tue May 17, 2011 12:28 am
by WilliamL
Yeah, that's where I saw it. :oops: Thanks Demivec!

Code: Select all

If Not #PB_Compiler_Debugger ; 0=off 1=on
    MessageRequester("Debugger off","")
EndIf
Just remember, if the debugger is off then no Debug messages!

Re: running under a debugger

Posted: Tue May 17, 2011 3:54 am
by Demivec
WilliamL wrote:Yeah, that's where I saw it. :oops: Thanks Demivec!

Code: Select all

If Not #PB_Compiler_Debugger ; 0=off 1=on
    MessageRequester("Debugger off","")
EndIf
Just remember, if the debugger is off then no Debug messages!
Here's a shorter version of the above:

Code: Select all

Debug "Debugger on"
:)

Re: running under a debugger

Posted: Tue May 17, 2011 4:29 am
by WilliamL

Code: Select all

Debug "Debugger on"
I like it! (KISS - KeepItSimpleStupid) :D