Re: Am I being debugged?
Re: Am I being debugged?
- Subject: Re: Am I being debugged?
- From: Kevin Grant <email@hidden>
- Date: Tue, 17 Feb 2004 19:13:46 -0600
In my Development build, I would like to be able to determine (at
runtime)
whether I am running inside gdb, or just running normally. What is the
best
way to do this?
Also, could I determine if I started normally, but have been attached
to
gdb?
A fairly simple test:
if (isatty(STDIN_FILENO))
{
. . .
}
This is true whenever you debug in Xcode or with gdb from a terminal,
and is never true if you launch from the Finder. While technically the
code above would also return true any time you launch your application
from a terminal shell, users aren't likely to do this. So, "probably"
it means you are being debugged.
Kevin G.
http://homepage.mac.com/kmg/
mail to kevin at ieee dot org
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.