Shortly after updating to Xcode 13.2.1 I started seeing some weird behaviour of breakpoints. When I run an app (in a simulator) some of my breakpoints change their look and turn to dotted blue outlined. Xcode does not stop execution at these breakpoints although code has been compiled, loaded and executed. I checked it in Console by adding some print
s.
When I hover over breakpoint Xcode shows a message:
Xcode won’t pause at this breakpoint because it has not been resolved
Resolving it requires that:
- The line at the breakpoint is compiled.
- The compiler generates debug information that is not stripped out (check the Build Settings).
- The library for the breakpoint is loaded.
All trivial solutions like reloading, reapplying breakpoints have not helped.
Did anybody else see something like this? Is there a way to solve it?
Screenshot for reference:
11
Answers
Ok, so in my particular case rebooting laptop has helped. All breakpoints are now good. But it would still be nice to know the cause of the problem.
In my case the issue was happening, because class was not added to the target, which I was trying to build.
Make sure that the file in which you are adding breakpoint is having correct target set in target membership.
If tried everything and nothing worked I suggest the following:
This is what worked for me.
I just passed through this problem and the solution for me was recreating the files.
Note: The ones I was trying to originally breakpoint on were copied from another project. When I created the new files, even though their Identity and Type looked just the same (target membership, encoding, paths), for some reason breakpoints started to work again.
Note 2: When copying and pasting code to your new files (if done manually), migrated breakpoints – created in the older file – will continue to fail. Only the ones created in this new file will work properly.
Hope it helps.
For my case somehow the code path was never invoked and very likely considered as dead code. The same thing applies when not adding the file to the target that you want to debug.
This can be the case or somehow debugger might not be able to resolve your breakpoint. The first thing in this case should be cleaning derived data and any caches.
But instead of recloning your repo you can just delete breakpoint config from the location described in this answer
For me reboot the Xcode, and it works~
My case
Working on framework development. Framework is injected into the sample app for development/run purpose. Breakpoints inside the framework won’t work.
Fix
Just removing xcframework in sample app and replacing with framework.
Reason
xcframework are precompiled outside of the app, so lib isn’t compiled when project is built and that’s why breakpoints doesn’t work.
What worked for me, was to select the files, delete them with – Delete>Move To Trash – and then drag the files back from the trash to the project.
I edit the answer because I’ve seen that if you have some strange character in the path to the file (some group name for example), the breakpoint is not resolved either.
I hope it helps
In Xcode 14 the problem is much more prevalent and "consistent". I figured out one pattern where it always fails and how to mitigate it.
If you have a final class then breakpoints set on or inside a private method will have that issue. If you remove private from the method or final from the class the breakpoints will get resolved properly.
Go to Build Settings, Find Generate Debug Symbol then set to YES