Xcode is stopping at auto-continue breakpoints
When I set a breakopint in my project, and click the "continue after evaluating all actions" c开发者_如何学编程heckbox, Xcode does not continue. Not only that, execution frequently appears to hang. This is true regardless of whether or not I actually have any actions on the breakpoint.
My non-autocontinue breakpoints work fine.
I tried a brand new project and the problem still occurred. So it must be related to a setting in either my computer or Xcode. I am using Snow Leopard and Xcode 4.0.2.
What could be the matter?
EDIT: code and console log.
code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
int x = 5;
printf("%d", x); // breakpoint here with autocontinue checked and no action
x+=2;
printf("%d", x);
return YES;
}
console log:
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 87901.
Pending breakpoint 1 - ""AutocontinueTestAppDelegate.m":21" resolved
Current language: auto; currently objective-c
57
It is interesting that even though the optimization was set to none, both printf statements fired.
If you are running your app on device, I just got this for you: Currently, auto-continue breakpoints only work on simulator, no on devices.
Source: some Apple engineer.
From what you describe, it sounds like it might be a bug in Xcode - report it here.
(Sorry my answer is not more helpful)
Can you paste your console log. Check that your 'Condition' and 'Action' are valid and without error. I just tested this with an action of resetAllAppData == NO
but the breakpoint did not halt execution because the 'Action' needs to be 'resetAllAppData == false
'.
This is the console log of another test:
Attaching to process 23361.
warning: Error parsing breakpoint condition expression
Pending breakpoint 1 - ""iPhoneAppDelegate.m":50" resolved
I got this error because I set the "Action" of the breakpoint to be the "Debugger Command" po resetAllAppData
and since resetAllAppData is not an Object typedef signed char BOOL;
it cannot execute the action and subsequently does not stop at the breakpoint.
This was happening to me, too. I noticed that at a given breakpoint it would only stop occasionally. The breakpoint was logging a BOOL to console using po
. Inspecting it I noticed that it would stop whenever that BOOL was 1 it would stop and append to the log [no Objective-C description available]
. Changing it to something that prevented that no-description-available "bug" resulted in auto continuation.
So now I'm using something like:
po (NSString *)[NSString stringWithFormat:@"%d", isCenterActive]
There might be a better and shorter solution, though.
精彩评论