Re: How to debug BetterAuthorizationSample
Re: How to debug BetterAuthorizationSample
- Subject: Re: How to debug BetterAuthorizationSample
- From: Eric Gorr <email@hidden>
- Date: Fri, 17 Jul 2009 19:31:19 -0400
Ok. Sadly, no matter what I try, I cannot get this to work with my own
helper tool. I tried this root trick, but it didn't work either.
Will start this up again on monday.
On Jul 17, 2009, at 6:49 PM, Jim Ingham wrote:
Yes. But again, so long as HelperTool was run with Root privileges
then you're going to need to run Xcode as Root for us to be able to
attach. You can do that, for instance by going to Terminal and doing:
> sudo /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Though be careful if you do this 'cause you'll end up rebuilding
stuff as root, and then when you go back to running Xcode as
yourself you'll get build failures because you can't overwrite the
files owned by root... There's a bug about running and debugging
root applications from a non-root user run Xcode but we haven't
gotten to that one yet.
Jim
On Jul 17, 2009, at 3:43 PM, Eric Gorr wrote:
Thank you.
So, I am guessing, if the situation had been a bit different and
HelperTool would have been executed, Path #2 below would have been
the correct path to follow?
On Jul 17, 2009, at 6:35 PM, Jim Ingham wrote:
This is a particularly gnarly example, because you don't actually
run HelperTool ever. Instead the Install tool copies your helper
app to
/System/PriviledgedHelperTools/com.example.BetterAuthorizationSample
and then that is actually what gets run. It's also a root app, so
you're going to have to debug it using -waitfor with command line
gdb (run under sudo) or somehow rejigger the whole build so it
doesn't rename the executable you're trying to debug and run Xcode
as root, or something like that. This worked though:
> sudo gdb
...
(gdb) attach -waitfor com.example.BetterAuthorizationSample
Waiting for process 'com.example.Bett' to launch.
<<< Launch the sample app, and click one of the buttons...
Attaching to process 3236.
Reading symbols for shared libraries . done
Reading symbols for shared libraries .......... done
0x920623f9 in _objc_search_builtins ()
(gdb)
Jim
On Jul 17, 2009, at 2:47 PM, Eric Gorr wrote:
On Jul 17, 2009, at 3:13 PM, Jim Ingham wrote:
The latest Xcode releases (3.1.3 and 3.2) have support for
this. Open your project, open the Active Executable Editor, go
to the Debugging pane and select "Debug next launch/Push
Notification". Then start the debugger, then do whatever causes
your program to start up...
Thank you.
Unfortunately, I cannot seem to get this to work. I will try to
be as explicit as possible when describing the steps I tried so
hopefully someone can spot where I have gone wrong.
First, I am using the sample project at:
http://developer.apple.com/samplecode/BetterAuthorizationSample/index.html
and I am using Xcode 3.1.3 on Mac OS X 10.5.7.
PATH #1:
1. I open up the project file
2. I set the HelperTool as the active Executable
3. I ctrl-click on the HelperTool in the Executables section in
the Groups & Files list
The 'Executable "HelpTool Info" window opens up
1. I switch to the debugging pane
2. I enable 'Wait for next launch/push notification'
3. I close this window
4. I set a breakpoint on the first assert line in
BASHelperToolMain in BetterAuthorizationSampleLib.c
5. I ctrl-click on App in the Executables section in the Groups &
Files list and select 'Start App with Breakpoints'
The application launches and I click on the three buttons, but at
no time does the debugger break in the helper tool
PATH #2
1. I open up the project file
2. I set the HelperTool as the active Executable
3. I ctrl-click on the HelperTool in the Executables section in
the Groups & Files list
The 'Executable "HelpTool Info" window opens up
1. I switch to the debugging pane
2. I enable 'Wait for next launch/push notification'
3. I close this window
4. I set a breakpoint on the first assert line in
BASHelperToolMain in BetterAuthorizationSampleLib.c
5. I press the debug button
A sheet appears saying:
Waiting for 'HelperTool' to launch...
The Debugger will attach to the process the next time it is
launched.
[] Disable "Wait for next launch/push notification.
[ Cancel ]
6. I go to BetterAuthorizationSample/build/Debug/ and launch
BetterAuthorizationSample SampleApp.app from the Finder
The application launches and I click on the three buttons, but at
no time does the debugger break in the helper tool
Which path was the most correct for me to follow?
Should both paths have worked?
What might I have done wrong?
Thank you.
Jim Ingham
Apple Developer Tools
Jim Ingham
Apple Developer Tools
_______________________________________________
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