Re: Running Xcode debugger as root
Re: Running Xcode debugger as root
- Subject: Re: Running Xcode debugger as root
- From: James Bucanek <email@hidden>
- Date: Mon, 18 Jun 2007 08:19:07 -0700
Rustam Muginov <mailto:email@hidden> wrote (Monday, June
18, 2007 6:25 AM +0400):
I am trying to debug launchd daemon (using the
http://developer.apple.com/technotes/tn2005/tn2083.html#
SECDEBUGGINGSTARTUP technote) and want to use GUI debugger from Xcode
IDE.
As far as I understand i need to launch Xcode from terminal using
"sudo /Developer/Applications/Xcode.app/Contents/MacOS/Xcode".
That's one way, yes.
As i try to do this, Xcode brings the "first run" dialog.
What you are seeing is perfectly normal. When you run as root,
you're running Xcode as a new user. Xcode naturally thinks it
has never been run before and goes through it's normal
first-time setup procedure.
Where would
it write the preferences file if run as root?
Root's home folder is normally /var/root
Can this have some
side-effect?
Sure, but not likely any disastrous ones. The biggest problem
that I run into is that all of the files created by Xcode while
running as root belong to root. Which can be a real pain to deal
with once you switch back to running Xcode as a regular user.
Is it safe to run Xcode as root?
Running GUI applications as root is outside the normal operating
parameters for the OS. But we're developers ... we live
dangerously. ;)
Perhaps where are other, legs ways to run gdb using Xcode GUI and having gdb running as root?
For debugging, I prefer this method:
- Set the SUID bit on the executable and set its owner to root
- Add code to the executable (just for debugging) to set the
EUID first to the current user (seteuid(getuid());). With the
executable running as your regular user, you can attach gdb to
it and begin an Xcode debugging session. Once gdb is attached,
let the executable switch it's EUID to root (seteuid(0)). You
can continue to debug the process while it runs as root.
There might be easier ways of doing this, but this works for my
projects and I avoid all of the hassle of trying to run Xcode as root.
James Bucanek
____________________________________________________________________
Author of Beginning Xcode ISBN: 047175479X
<http://www.beginningxcode.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden