A very simple situation. I'm working on an application in Delphi 2007 which is often compiled as 'Release' but still runs under a debugger. And occasionally it will run under SilkTest too, for regression testing. While this is quite fun I want to do something special...
I want to detect if my application is running within a debugger/regression-tester and if that's the case, I want the application to know which tool is used! (Thus, when the application crashes, I could report this information in it's error report.)
Any suggestions, solutions?
Debugging tool is a computer program used to test and debug other programs. There are a lot of public domain software like gdb and dbx that you can use for debugging. Also, they offer console-based command-line interfaces. Some of the automated debugging tools include code-based tracers, profilers, interpreters, etc.
But there are various differences between testing and debugging. Testing is the process using which we find errors and bugs. Debugging is the process using which we correct the bugs that we found during the testing process.
You can check the parent process that started your application.
With CreateToolhelp32Snapshot
/Process32First
/Process32Next
get the parent PID (PROCESSENTRY32.th32ParentProcessID
or TProcessEntry32.th32ParentProcessID
) for your application PID. Then get the filename for the parent PID to compare with the applications you want to check for, like SilkTest.
Check this article for code usage.
In addition to IsDebuggerPresent
and CheckRemoteDebuggerPresent
, you can also query PEB.BeingDebugged
(PEB is Process Environment Block, to get PEB you must query TEB, which is the Thread Enviroment Block).
You're probably looking for the IsDebuggerPresent
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With