Re: How to debug BetterAuthorizationSample
Re: How to debug BetterAuthorizationSample
- Subject: Re: How to debug BetterAuthorizationSample
- From: Jim Ingham <email@hidden>
- Date: Fri, 17 Jul 2009 15:35:22 -0700
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
_______________________________________________
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