Can’t set breakpoints in Xcode 4 and debugger does not stop
Questions: I downloaded the latest Xcode 4 (iOS SDK 4.3) from the Apple’s web site. The new look and behavior gives me headache. I am trying to rebuild my old iPhone projects on an OS X 10.6.6 iMac machine but run into several issues. One of them is the debugger when the device is set to Simulator. While the project builds with no error, the debugger does not stop at any of the breakpoints I set! The color of breakpoints is either light blue (dimmed blue) or orange (yellow) and never dark blue. Restarting Xcode does not fix the problem. What is happening?
Answer: Xcode 4 is fundamentally different from its predecessors but old errors sometimes revitalize. The orange breakpoint means that GDB can not resolve your symbols and that breakpoint will not be hit.
There is no change in setting breakpoints: open the source-code file and click in the gray gutter next to the spot where you want the debugger to stop. Look at the breakpoint-state button in the toolbar to see whether Xcode has indeed activated your breakpoints or not.
If the breakpoint is not triggered, try out these steps:
1. a must do checklist:
- be sure the ‘Active Device’ is properly set, ‘Active Configuration’ is set to Debug and the Target is correct, and
- you cleaned all targets and rebuilt your app, and
- Generate Debug Symbols is checked and Optimization Level is set to 0 in Build Settings.
2. When you debug a Device (iPhone or iPad) and cannot set breakpoints in Xcode 4:
- reboot the device,
- rebuild the app and
- run it again. The debugger will likely find the breakpoints now.
3. On the left Navigator pane there is now a Breakpoint Navigator where all the brekpoints are listed and managed.
4. In Xcode 4 a new breakpoint is local to the given workspace. If you add the project containing that breakpoint to another workspace, the breakpoint is not copied to the new one. Check it out.
5. In earlier Xcode version find Xcode -> Preferences -> Debugging tab. Uncheck Load symbols lazily if checked. It seems to be dropped from Xcode 4.
- If you do not find these bits in Xcode 4, select the project file in the Project Navigator. Select the target you like to build. Then select Build Settings->All->Levels.