views:

7615

answers:

14

I have breakpoints set but Xcode appears to ignore them.

+18  A: 

Go to the Xcode Debugging preferences. Make sure that "Load Symbols lazily" is NOT selected.

AlanKley
Thanks - that was frustrating for a little while.
Grumdrig
A: 

When setting your break point, right click and you should get several options about how the break point is handled (log vars and continue, pause execution, etc)

Also make sure the "Load Symbols lazily" is not selected in the debug preferences.

(Applies to Xcode 3.1, not sure about past/future versions)

Scott S.
+18  A: 

First of all, I agree 100% with the earlier folks that said turn OFF "Load Symbols Lazily."

I have two more things to add.

My first suggestion sounds obvious, but the first time someone told me this I was on the verge of responding with "oh, come on, you really think I wouldn't know better...... oh."

  1. Make sure you haven't accidentally set your "Active Build Configuration" to "Release."

  2. Under "Targets" in the graphical tree display of your project, right click on your Target and do "Get Info." Look for a property named "Generate Debug Symbols" (or similar) and make sure this is CHECKED (aka ON). Also, you might try finding (also in Target >> Get Info) a property called "Debug Information Format" and setting it to "Dwarf with dsym file."

There are a number of other properties under Target >> Get Info that might be affecting you. Look for things like optimizing or compressing code and turn that stuff OFF (I assume you are working in a debug mode, so that this is not bad advice). Also, look for things like stripping symbols and make sure that is also OFF.

que que
A: 

I haven't done xcode in a bit, but I recommend that you disable "Zerolink" and "Load Symbols Lazily"; that will fix most problems. Zerolink is an abomination anyway.

duane
A: 

There appears to be 3 states for the breakpoints in Xcode. If you click on them they'll go through the different settings. Dark blue is enabled, grayed out is disabled and I've seen a pale blue sometimes that required me to click on the breakpoint again to get it to go to the dark blue color.

Other than this make sure that you're launching it with the debug command not the run command. You can do that by either hitting option + command + return, or the Go (debug) option from the run menu.

crackity_jones
+2  A: 

I have a lot of problems with breakpoints in Xcode (2.4.1). I use a project that just contains other projects (like a Solution in Visual Studio). I find sometimes that breakpoints don't work at all unless there is at least one breakpoint set in the starting project (i.e. the one containing the entry point for my code). If the only breakpoints are in "lower level" projects, they just get ignored.

It also seems as if Xcode only handles breakpoint operations correctly if you act on the breakpoint when you're in the project that contains the source line the breakpoint's on.

If I try deleting or disabling breakpoints via another project, the action sometimes doesn't take effect, even though the debugger indicates that it has. So I will find myself breaking on disabled breakpoints, or on a (now invisible) breakpoint that I removed earlier.

Charles Anderson
A: 

I believe that a project can also become corrupted in regards to breakpoints. I have a project, for example, that WILL NOT break on any breakpoints that it remembers from the previous session. I first wrote about this here

AlanKley
A: 

I've had my breakpoints not work and then done Build / Clean All Targets to get them working again.

snowytree
A: 

Also make sure that the AppStore distribution of the app is not also installed on the device.

A: 

I was just having this same issue (again). After triple-checking "Load symbols lazily" and stripping and debug info generation flags, I did the following:

  1. quit xcode
  2. open a terminal window and cd to the project directory
  3. cd into the .xcodeproj directory
  4. delete everything except the .pbxproj file (I had frank.mode1v3 and frank.pbxuser)

You can accomplish the same task in finder by right/option-clicking on the .xcodeproj bundle and picking "Show Package Contents".

When I restarted xcode, all of my windows had reset to default positions, etc, but breakpoints worked!

Frank Szczerba
A: 

Another thing to check is that if you have an "Entitlements" plist file for your debug mode (possibly because you're doing stuff with the Keychain), make sure that plist file has the "get-task-allow" = YES row. Without it, debugging and logging will be broken.

davidcann
+2  A: 

See this post: Breakpoints not working in Xcode?. You might be pushing "Run" instead of "Debug" in which case your program is not running with the help of gdb, in which case you cannot expect breakpoints to work!

Soong
A: 

I have Xcode 3.2.3 SDK 4.1 Breakpoints will fail at random. I have found if you clean the build and use the touch command under build they work again.

Damon McGIll
A: 

Here's an obscure one I've run into: if you're working on a shared library (or a plugin), your breakpoints will go yellow on startup, which might cause you to hammer your keyboard in frustration and kill the debug process. Well, don't do that! The symbols won't get loaded until the app loads the library, at which point the breakpoints will become valid. I ran into this problem with a browser plugin... BPs were disabled until I browsed to a page that instantiated my plugin.

Tim Keating