Re: How to debug BetterAuthorizationSample
Re: How to debug BetterAuthorizationSample
- Subject: Re: How to debug BetterAuthorizationSample
- From: Eric Gorr <email@hidden>
- Date: Mon, 20 Jul 2009 16:43:53 -0400
Just wanted to let you know that I was able to get this working
exactly as described. I am not sure what I was doing wrong on Friday,
but stepping back over the weekend seemed to have cleared away the
blocks and today I was able to get it working reliably and am
confident I can get it to work again in the future.
On Jul 17, 2009, at 7:38 PM, Jim Ingham wrote:
If you can't get this to work at all, file a bug with your test
project and turn on the Xcode/gdb log in the Debugging pane of the
Xcode preferences and include the log from one of the failed
debugging sessions and we'll take a look. This is a new feature, so
it's entirely possible that there's some use case we didn't think of
that doesn't work properly.
Jim
On Jul 17, 2009, at 4:31 PM, Eric Gorr wrote:
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
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