Re: Debugging a privileged process
Re: Debugging a privileged process
- Subject: Re: Debugging a privileged process
- From: Kaelin Colclasure <email@hidden>
- Date: Mon, 26 Jan 2004 14:42:39 -0800
On Jan 26, 2004, at 10:57 AM, Jim Ingham wrote:
Kaelin,
On Jan 24, 2004, at 5:55 PM, Kaelin Colclasure wrote:
Greetings,
I've just finished porting a daemon program that uses raw sockets to
Mac OS X, and now I'd like to be able to use Xcode's snazzy GDB
integration to debug it, Shark to profile it, etc. Since it uses raw
sockets, it must or course run as a privileged process. Is it
possible to accomplish this from the Xcode IDE? Do I need to run all
of Xcode under sudo? (And if so are there any caveats to doing so?
ISTR some admonishments against using the AppKit classes in a
privileged process.)
Yes, you need to run Xcode under sudo. Dunno about caveats, though.
I gave it a quick shot and I can indeed execute my process under the
debugger and with the necessary privileges. But this does raise a few
obvious questions like, "Where to Xcode's preferences get written?"
Since the root user has no home directory, do these get sprayed into
the root of the filesystem somewhere? (Nominally this a more of a
generic Cocoa question, I suppose.)
And on a related topic, I am accustomed to being able to attach GDB
to a running process (designated by PID) and start a debugging
session that way. Yet I did not see any obvious option for doing this
from Xcode... Did I just miss it, or should I file an enhancement
request? :-)
There isn't any UI for doing this, but it is pretty easy to do. Open
the inspector for the executable that you want to debug (just
double-click on the name in the Executable section of the Group tree).
Scroll down to the bottom, and in Launch Configuration, configure the
Debug action, and set After Launching to "Do not start executable".
Then start the debugger, go to the console and type
(gdb) attach PID
Ah yes, that works beautifully. Thanks!
Don't bother filing an enhancement request on this one, we have a
couple already..
Jim
--
Jim Ingham email@hidden
Developer Tools
Apple Computer
_______________________________________________
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.
_______________________________________________
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.