142

I have breakpoints set but Xcode appears to ignore them.

pkamb
  • 33,281
  • 23
  • 160
  • 191
AlanKley
  • 4,592
  • 8
  • 40
  • 53

52 Answers52

164

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 suggested it to me, my reaction went along these lines: "come on, please, you really think I wouldn't know better...... oh.")

  1. Make sure you haven't accidentally set "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 affect 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. For example, "Strip Linked Product" should be set to "No" for the Debug target.

pestophagous
  • 4,069
  • 3
  • 33
  • 42
  • 8
    On XCode 4.5.2 I had this issue and it turned out to be because I had enabled "Link-time optimization", so that's another thing to check – taxilian Dec 04 '12 at 16:58
  • 8
    To change the Build Configuration, go to Product -> Scheme -> Edit Scheme, under Run - Info. For me what worked was checking "Debug Executable" in that menu. – Jeffrey Sun Oct 06 '14 at 20:47
  • 2
    Hijacking the top answer to add that Bison syntax seems to be another (exotic) cause of breakpoints not working (see my answer below). Hopefully will save some time to the next person with that problem. – Dave Oct 16 '14 at 07:06
  • 2
    It's also super easy to inadvertently toggle breakpoint activation with ⌘Y. So watch out for that, kids. – dsgrnt Dec 13 '14 at 21:00
  • I had same issue since working off an open source project which had a appstore release build run config as well as a debug one, you have to make sure to select the debug one. – user1601259 Oct 17 '15 at 05:03
  • "Load Symbols Lazily" is not an option in my Xcode 8. Seems to have disappeared in Xcode 6 http://stackoverflow.com/questions/26231671/where-can-i-find-load-symbols-lazily-option-in-xcode6 – Michael Osofsky May 10 '17 at 19:08
  • 1
    To set "Active Build Configuration" to "Debug" instead of "Release" in Xcode 8 go to Product -> Scheme -> Edit Scheme. Click Run on left side. Click Info on top of screen. In Build Configuration drop-down, choose "Debug". – Michael Osofsky May 10 '17 at 19:13
  • 1
    Another setting that might prevent breakpoints to take effect is _"Strip Debug Symbols During Copy"_ – elitalon Feb 02 '18 at 09:34
  • 1
    This suggestion isn't really relevant for xcode 10.2.1 which is the version I am using. – llamacorn Jul 10 '19 at 18:19
  • Any Xcode 10 solution? I need to keep building my project until breakpoints finally work. – Chewie The Chorkie Jul 19 '19 at 17:23
  • 1
    @llamacorn ... your comments are delivered to me, but I no longer code on Mac at the moment, so I cannot help with Xcode 10 (sadly). I'm sorry about that! You may need to post a fresh new question with Xcode 10 in the title. – pestophagous Jul 19 '19 at 18:11
  • @chewie-the-chorkie please see my comment to llamacorn just now. Sorry I cannot be of assistance with Xcode 10. – pestophagous Jul 19 '19 at 18:12
  • @pestophagous thank you, I coincidentally already posted about it here if anyone can help: https://stackoverflow.com/questions/57117144/breakpoints-only-sometimes-work-in-xcode-10 – Chewie The Chorkie Jul 19 '19 at 19:40
  • omfg thx @taxilian. that solved it for me. xcode 11, 2019, this was driving me crazy. somewhat incredible that xcode does not warn you about that, facilitate turning off while debugging. lost 1 day "debugging" the user-interface of xcode – ㄈㄟㄈㄟ 23 mins ago – mrchance Aug 28 '19 at 08:02
  • Under "Targets" in the graphical tree display of your project <<<--- can u please attach a screenshot pleassssssee? – elliotching Jun 01 '22 at 07:11
  • right click on your Target and do "Get Info." << there is no "Get info" options – elliotching Jun 01 '22 at 07:13
86

In Xcode 7, what worked for me was:

  1. Make sure that the Target > Scheme > Run - is in Debug mode (was Release)

  2. Make sure to check the option "Debug executable":

Debug executable

pkamb
  • 33,281
  • 23
  • 160
  • 191
Oded Regev
  • 4,065
  • 2
  • 38
  • 50
23

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

AlanKley
  • 4,592
  • 8
  • 40
  • 53
18

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!

logancautrell
  • 8,762
  • 3
  • 39
  • 50
Frank Szczerba
  • 5,000
  • 3
  • 31
  • 31
14

One of the possible solutions for this could be ....go to Product>Scheme>Edit scheme>..Under Run>info>Executable check "Debug executable".

Soropromo
  • 1,212
  • 12
  • 17
13

For Xcode 4.x: Goto Product>Debug Workflow and uncheck "Show Disassembly When Debugging".

For Xcode 5.x Goto Debug>Debug Workflow and uncheck "Show Disassembly When Debugging".

Nawaz
  • 65
  • 1
  • 7
bneupaane
  • 537
  • 1
  • 7
  • 16
12

Another reason

Set DeploymentPostprocessing to NO in BuildSettings - details here

In short -

Activating this setting indicates that binaries should be stripped and file mode, owner, and group information should be set to standard values. [DEPLOYMENT_POSTPROCESSING]

enter image description here

hbk
  • 10,908
  • 11
  • 91
  • 124
  • After updating to XCode 7, This setting was somehow `YES` only in my `subproject` and then breakpoints didnt work in `subprojects`. And after setting to `NO`, it was perfect! – Maheswaran Ravisankar Feb 17 '16 at 13:59
  • This worked for me only after cleaning the project so a full rebuild will take place. – Ran Mar 09 '16 at 14:29
10

Issue

  • Background
    • Xcode: 13.0
      • code: Objective-C
  • Issue: added breakpoint, but not work
    • enter image description here

(possible) Reason and Solution

  • Reason: Xcode bug
    • Solution: Product ->Clean Build Folder, then retry debug (multiple time)
      • enter image description here
  • Reason: disabled Debug
    • Solution: enable it: Product->Scheme->Edit Scheme->Run->Info
      • Build Configuration set to Debug
      • choose/select/enable: Debug executable
      • enter image description here
  • Reason: disabled all breakpoint
    • Solution: enable it: Debug panel -> click breakpoint icon
      • enter image description here
  • Reason: debug info be optimized
    • Solution: not optimize
    • click Project -> Build Settings -> Apple Clang - Code Generation -> Optimization Level -> Debug make sure is None[-O0]
      • enter image description here

Related

XCode's Symbolic breakpoint not work

  • Background

XCode crash log

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSCFConstantString stringByAppendingString:]: nil argument'

add XCode symbolic breakpoint

-[__NSCFConstantString stringByAppendingString:]:

but breakpoint not working

  • Solution

change to:

-[NSString stringByAppendingString:]

related doc: stringByAppendingString:

crifan
  • 12,947
  • 1
  • 71
  • 56
9

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
  • 91
  • 1
  • 1
  • In Xcode 6.4, there is now only a Run button and whether it runs a debug configuration or not depends on the currently selected scheme settings. – user2067021 Jul 23 '15 at 05:32
6

Solution for me with XCode 9.4.1 (did not stop at any breakpoint):

Under build Target -> Build Settings -> Optimization Level: Switched from "Optimize for speed" -> "No optimization" (now it's slower but works)

Strinder
  • 2,111
  • 2
  • 21
  • 34
6

What solved it in my case was quite simple, in Xcode - Product - Clean Build Folder followed by Product - Run (not the Play Xcode button).

(Had the issue on Xcode 11 -beta 4 after switching to unit testing with Xcode play button long press)

Lukas
  • 3,423
  • 2
  • 14
  • 26
5

This had me in Xcode 9 for half a frustrating day. It ended up been a simple debug setting.

Go Debug > Debug Workflow and make sure 'Always Show Disassembly' is turned off. Simple as that. :(

Gaz Long
  • 347
  • 3
  • 13
4

For Xcode 4:

go Product -> Debug ->  Activate Breakpoints

This is applicable for all Xcode version. Shortcut key is: command key + Y. Press this key combination to activate/deactivate breakpoints.

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
evya
  • 3,381
  • 1
  • 25
  • 28
4

Came to this page with the same problem (C code in Xcode 6 not stopping at breakpoints) and none of the solutions above worked (the project was practically out of the box, settings-wise, so little chance for any of the debugger settings to be set to the wrong value)...

After wasting quite some time reducing the problem, I finally figured out the culprit (for my code):

Xcode (/LLVM) does not like Bison-style #line preprocessor commands.

Removing them fixed the problem (debugger stopped at my breakpoints).

Dave
  • 291
  • 2
  • 13
2

Deleting my Build folder solved the problem for me.

Jack Bellis
  • 1,177
  • 8
  • 10
2

For this, and also for Xcode 6 and above make sure that the breakpoint state button is activated (the blue arrow-like button):

enter image description here

df611
  • 143
  • 11
2

If all else fails, instead of a breakpoint, you can call the following function:

void BreakPoint(void) {
    int i=1;
    #if !__OPTIMIZE__
    printf("Code is waiting; hit pause to see.\n");
    while(i);
    #endif
}

To resume, manually set i to zero, then hit the resume button.

William Jockusch
  • 26,513
  • 49
  • 182
  • 323
2

It has happened the same thing to me in XCode 6.3.1. I managed to fix it by:

  • Going to View->Navigators->Show Debug Navigators
  • Right click in the project root -> Move Breakpoints (If selected the User option)
  • (I also Selected the option share breakpoints, even though I'm not sure if that necessary).

After doing that change I set the Move breakpoints options back to the project, and unselecting the Share breakpoints option, and still works.

I don't exactly know why but this get my breakpoints back.

Osk
  • 434
  • 4
  • 16
2

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

2

I think the problem could be incompatibility between device versions and Xcode. I have this problem when attempting to debug on my iPhone 4S running iOS 5.0.1. I am still using Xcode 3.2.5. I got the symbols from the handset by selecting "use this device for development" in the Organiser window. This phone refuses to breakpoint however. My old 3GS will breakpoint, same Xcode project, same settings... just different device and it's running iOS 4.0. I guess this is an Xcode bug in 3.2.5, since I have the symbols. Having tried all the solutions posted here so far, I have decided the solution to my problem is to go ahead and upgrade to XCode 4. Perhaps you cannot debug effectively unless your base SDK is at least as high as the system on which to debug. Maybe that's obvious - can anyone confirm?

Edit: I will update when I can confirm this is true.

Gavin
  • 121
  • 2
  • 3
2

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
  • 19,321
  • 13
  • 57
  • 73
1

In Xcode 4

- Product menu > Manage Schemes
- Select the scheme thats having debugging problems (if only one choose that)
- Click Edit button at bottom
- Edit Scheme dialog appears
- in left panel click on Run APPNAME.app
- on Right hand panel make sure youre on INFO tab
- look for drop down DEBUGGER:
- someone had set this to None
- set to LLDB if this is your preferred debugger
- can also change BUILD CONFIGURATION drop down to Debug 
-      but I have other targets set to AdHoc which debug fine once Debugger is set
brian.clear
  • 5,277
  • 2
  • 41
  • 62
1

I found the problem. Somehow the "Show Disassembly when debugging" was enabled in my XCode which creates that problem. When I disabled it, all my debugger stopped in my source code.

You can find it under: Product->Debug Workflow->Show Disassembly when debugging.

Robert
  • 5,278
  • 43
  • 65
  • 115
Perumal
  • 11
  • 1
1

You can Activate / Disactivate Breakpoints in dropdown menu enter image description here

Stan
  • 122
  • 4
1

I tried all the above things but for me only deactivating the debugging breakpoints once and then activating them worked.

smohta
  • 11
  • 1
0

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
  • 1,360
  • 1
  • 15
  • 17
  • Note that the get-task-allow entitlement may be included by an Xcode Managed Profile: https://imgur.com/a/qS27asO – Carl G Nov 29 '21 at 15:45
0

If you are using subversion, just revert your project files (only) to the last time you knew the debugger was working.

stephen
  • 1,039
  • 14
  • 31
0

Just solved this in XCode 4.2, none of above helped. The thing was (I'm not sure what actually happened, but, maybe this helps someone): my teammate created new build configurations and updated project in SVN. I had old build configuration set up in Run Scheme settings, so the steps for me were:

  1. Product -> Edit Scheme...
  2. Select "Run %project_name.app%" (or whatever causes problem)
  3. In build configuration combo select that new build configuration from my teammate

And that's all, breakpoints are back again. Hope this helps.

MANIAK_dobrii
  • 6,014
  • 3
  • 28
  • 55
0

Another reason the breakpoints can turn yellow is if the application binary you are debugging has been modified since it was first run. In my case, I added a folder to the application's Contents/Resources folder after having debugged the program once. On the debug run after adding the folder, the breakpoints turned yellow and were ignored. I modified my procedure: I did a clean, a build, added the folder, then ran, and all was well.

Perhaps Xcode (or OS X) creates and remembers its own digital signature of the application (which was not digitally signed) and then, sensing that the application was modified, refuses to try to set breakpoints. By making my mods before the first (debug) run of the application, the digital signature was made with my mods.

All this on OS X 10.6.8 using Xcode 3.2.2.

user532477
  • 325
  • 1
  • 4
  • 8
0

You can check one setting in target setting Apple LLVM Compiler 4.1 Code Generation Section Generate Debug Symbol = YES

Pushan
  • 9
  • 2
0

This happens from time to time with an iOS project at least. To fix it, I had to reboot the iOS device, quit Xcode, and rebuild the project.

kakyo
  • 10,460
  • 14
  • 76
  • 140
0

Having both Xcode 5 and 6 GM caused the former to lose breakpoint functionality (Xcode 6 betas were ok).

I tried many of the suggested methods but finally gave up and I'm just using Xcode 6 now.

Rivera
  • 10,792
  • 3
  • 58
  • 102
0

On Xcode 6.4, I needed to reboot my Mac.

(Tried enabling/disabling breakpoints, rebooting iOS device, restarting Xcode, deleting breakpoint files from the workspace package...)

user2067021
  • 4,399
  • 37
  • 44
0

I've had problems with Xcode losing breakpoints when using the simulator and having the Scheme Launch setting to "wait for executable". Change that to "launch automatically" and breakpoints come back to life.

Richard
  • 1,249
  • 16
  • 25
0

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.

0

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
  • 6,443
  • 4
  • 47
  • 53
0

I have started to get this issue when updated my xCode into Version 11.0 (11A420a). To solved that I have installed additional simulator version 12.2 and updated my iPhone version into 13.1. Now both on iOs simulator and on my device break points get hit.

T M
  • 3,195
  • 2
  • 31
  • 52
0

In my case i was overriding the existing app store build with my build.I removed the same and its working now.

Ashish Gupta
  • 358
  • 4
  • 9
0

if you using Xcode Version 11.1 (11A1027) make sure you are not using the app store credential(provisioning profiles) , because in this case build will be installed and no log or debugger will work, it took me hell lot of time to figure it out , updated Xcode has chagned . now build getting installed on the device without any warning.

Alok
  • 266
  • 2
  • 11
0

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 Swezey
  • 2,147
  • 2
  • 18
  • 28
0

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.

logancautrell
  • 8,762
  • 3
  • 39
  • 50
gnkdl_gansklgna
  • 2,227
  • 1
  • 16
  • 17
0

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.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
crackity_jones
  • 1,077
  • 2
  • 13
  • 16
0

For those who are facing issue in Swift Package and the breakpoints are not working. the issue is the case sensitivity of path property in of target

screenshot of package path

The path was set to source, Issue fixed once It is set to Source

Mujahid Daud Khan
  • 1,983
  • 1
  • 14
  • 23
0

I was facing the same problem when I wanted to debug a web plug-in where the custom executable was Safari 5.1. It was working fine till upgraded my Safari to 5.1 from 4.0.5. Once I installed Safari 4.0.5 again, all breakpoints started working without modifying any Xcode setting.

logancautrell
  • 8,762
  • 3
  • 39
  • 50
0

In my case breakpoints were turning off themselves because the function in which I put them was private and was not available and never called. So check for access level

0

I was facing a problem like that and after a lot of wasted time i realized that other developer created a folder using special characters, after renamed folder breakpoints is back working

Euler Tiago
  • 134
  • 2
  • 4
0

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

0

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
  • 4,592
  • 8
  • 40
  • 53
-1

I have Xcode Version 4.6.3 and Breakpoints were never working in sub-groups of included projects. The project would compile and run fine; it would even attach to the debugger and spit out NSLog output appropriately.

The issue was related to my Header Search Paths. I had some of them set 'recursive' instead of the default 'non-recursive'. Changing them all to 'non-recursive' and updating all of the related imports appropriately fixed the problem.

Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
-1

In my case, I found out that the breakpoints have been accidentally deactivated. You can reactivate it again via Debug->Activate Breakpoints [Cmd+Y]. If you notice grey'ed out breakpoint markers instead of the usual blue marker, this is likely the case.

As it turned out you can always toggle breakpoints activation with Cmd+Y keys, you might have hits this combination key not noticing it. This report is based on Xcode 7.2.

Benny Khoo
  • 725
  • 6
  • 15
  • This same answer was already provided years ago ([2012](https://stackoverflow.com/a/13684779/39396), [2015](https://stackoverflow.com/a/29062395/39396).) Please ensure that you are not duplicating other answers. – Carl G Nov 29 '21 at 15:36
-1

Thing to try :

1 ) restart xcode 2 ) select another simulator -- which was my case 3 ) reboot mac.

if none of this works. then look at the project settings. ( which is leeast possible thing. )

user3812138
  • 261
  • 4
  • 11
-2

I had the similar issue. I re-installed xcode. that solved my problem

kiri
  • 9
  • 1