Breakpoint ignored in XPC in Xcode 8.1

Hi,


I've set a breakpoint in my XPC service and Xcode 8.1 seems to ignore it... It does work in Xcode 7.3.1 so I guess I'm not doing anything wrong.

Also, NSLogs are not printed to Xcode 8.1's console while they are in 7.3.1.


I have another project with an XCP service and breakpoints work fine there with both versions ...


Has anyone experienced this problem too ?

Did someone found a workaround ? A setting that could cause this ?


Thank you !

Replies

I have just encountered exactly the same problem: in Xcode 8.2.1 breakpoints set in XPC services are ignored and no NSLogging messages from XPC services are printed into the console (but XPC services work fine). Everything worked fine in Xcode 7.3.1.


Valerian, have you figured out what could be causing this issue?

I'm having trouble with this in Xcode 9.2 still.


What I've noticed is that it works the FIRST TIME my project is open and I build and run: the logs from both processes show up, any breakpoints I have in the XPC service are hit, and the debugger catches the XPC service if it crashes.



The SECOND time I build and run, it takes a long time for my XPC service to show up in the debugger panel dropdown. The Xcode status bar is stuck on "Attaching to [XPC Service]". Nothing from the service ends up in the logs, and the log section is blank even when I switch the debugger panel over to the service itself. (If I hit pause, the lldb shell does seem to be connected to my service, however, but this isn't terribly helpful most of the time.)


Any more tries, clean build, closing just the project, etc. and it still doesn't work. If I want ONE CHANCE at seeing what's going on I need to completely Quit Xcode and launch it again. (Though it looks like the fellow who posted https://www.youtube.com/watch?v=iX2b5hgfi5I sees this as an intermittent thing, rather than a one-time-only feature?)


I tried the suggestion at https://stackoverflow.com/a/10810602/179583 to manually configure Xcode to attach by ID. This causes the same ± useless behavior, only now in the debugger dropdown I eventually see my service listed *twice* (once with real PID, another time with -2 PID) and no console output or breakpoints being hit.

After reading through http://asciiwwdc.com/2013/sessions/407 I also made sure that my scheme had "Debug XPC Services used by this application" checked. (And un-checked/re-checked it for good measure…)


Looks like there's another thread at https://forums.developer.apple.com/message/204687#204687, also unanswered :-/



My workarounds so far have been:


* do as much development in the main app, and then move the code over to the service once it's ± working

* have launchd run the service and connect to it via Mach. then I can at least redirect stdout/stderr to a text file on my desktop…


Given that this was touted as something that Just Works™ way back at WWDC 2013, I imagine it's supposed to be easier than this??