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.
Notes:
- 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.
Comments
Log in to post (or reply to) a comment. You can use your Twitter account.
This blog was originally designed for our own project partners and freelance programmers to share questions and solutions in this online private pub. From April 1, 2011 we open the blog for all of you to add comments or ask a question in a new post. All comments and posts are moderated before they are posted to verify the quality of content on our pages. Comments are usually posted within 15 minutes. Posts may be re-edited. You can post source codes in comments using [code][/code] tag.


