Xcode breaks with SIGCONT before OpenURL handler is called

We define an event handler for OpenURL

Code Block
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];

And we handle it here:

Code Block
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
           withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
// Handler type stuff
}

If I'm debugging in Xcode, I see a SIGCONT before the handler is called. When I continue from the SIGCONT, I enter the handler and everything is fine.

This causes automated tests to break, and is generally a pain in the you-know-where. Outside of Xcode it's fine.

How can I make it stop doing this? Is there some Xcode setting I've overlooked?


Answered by kjbrock in 668451022
The main problem is UI testing with XCTest, although it also happens with plain debugging.

I've set a symbolic breakpoint on NSApplicationMain, and am runniing process handle -s false SIGCONT with an automatic continue.

It works the first time, but if I stop and re-run the application it will occasionally still break with a SIGCONT, which is a little odd. Much, much, less frequent though.






Hmmm, the SIGCONT is weird. I’m not entirely sure what that’s about. It is, however, innocuous at runtime, meaning that this is the main issue:

This causes automated tests to break, and is generally a pain in the
you-know-where.

Does disabling this in LLDB work? For more on this, see:

Code Block
(lldb) help process handle


Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Well, if I set

Code Block
process handle -s false SIGCONT

At application load, then the test continues without entering the debugger. That doesn't help by itself because it still requires manual intervention at multiple points during the test suite.

I haven't found any good documentation on custom LLDB settings, especially settings that take effect after the process is running. I've verified that .lldbinit is read on start of the testing and again when the process enters the SIGCONT break point.

The problem is that the

Code Block
process handle . . .

command is target-specific, and can't be run without a target. Even when breaking for SIGCONT I get an error about an invalid target for that command.

Is there any documentation on how to override LLDB behavior from a configuration file, including commands which only take effect in a specific process? For example "when LLDB attaches to a target do X". A way to change global LLDB behavior would also be good if one exists.




At application load, then the test continues without entering the
debugger.

What sort of tests are we talking about here? Using Xcode’s test infrastructure (XCTest)? Or something else?

And if it’s XCTest, is this a unit test or a UI test?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Accepted Answer
The main problem is UI testing with XCTest, although it also happens with plain debugging.

I've set a symbolic breakpoint on NSApplicationMain, and am runniing process handle -s false SIGCONT with an automatic continue.

It works the first time, but if I stop and re-run the application it will occasionally still break with a SIGCONT, which is a little odd. Much, much, less frequent though.






people speak of executing:

process handle -s false SIGCONT

but fail to mention exactly how to do so. can i edit an xcode IDE setting, or a project setting, or a run option / argument in the GUI somehwere such that this function is ALWAYS executed as i run my app from xcode?

Xcode breaks with SIGCONT before OpenURL handler is called
 
 
Q