简体   繁体   中英

Breakpoints not hit in Xcode (9.3)

None of my breakpoints are being hit.

I've tried the following:

  • Deleted Derived Data directory
  • Cleaned build folder
  • Deleted the xcuserdata directory
  • Made sure build configuration is Debug and Debug executable is ticked
  • Made sure Generate debug symbols is set to Yes
  • Changed Optimization level to No optimization

The breakpoints are still not being hit.

Had this exact issue today - breakpoints in Swift projects were failing in XCode 9.3 (objective-c ones were fine).

The following fixed it:

change Optimization level under the Swift Compiler - Code Generation submenu. Move it from -O to -Onone

在此处输入图片说明

src: https://www.reddit.com/r/swift/comments/89nht7/breakpoints_not_working_after_updating_to_xcode_93/?st=jftp4n02&sh=49688058

Try below steps

  1. Go to debug (top bar in Xcode)
  2. Debug Workflow
  3. Always show Disassembly - uncheck it

None of the existing answers worked for me so I dug into what was going on. By forcing a breakpoint in code (ie an asm("int3;") instruction) I was able to see that the symbols weren't loading. Naturally breakpoints depend on symbol information being loaded.

The code for which my breakpoints weren't working was in a C++ framework and the framework has a build setting called " Strip linked product " which was defaulted to "Yes" for both release and debug builds. By setting this to "No" for the debug build (and doing a full rebuild) my breakpoints now work again.

I had set Deployment Postprocessing to NO in my Build Settings for my target. Setting this to YES made my breakpoints work again.

In my case problem was in the Debug information format setting. It was set to DWARF instead of DWARF with dSYM File . Reseting it to the default value solved the problem.

Check Preferences > Behaviors > Running > Pauses options. The Show for navigator and debugger must have ticked.

I was facing the same issue and this solution works for me:

  • Open project settings
  • Optimization Level
  • Under "Swift Complier - Code Generation" Section
  • Set " Optimization Level " to No Optimization[-Onone]

Refer attached screen shot在此处输入图片说明

在此处输入图片说明

Select breakpoint tab in XCode delete all the old breakpoints. Then add new breakpoints. It worked for me.

None of the previous solutions worked for me either. I had an issue where all my breakpoints would work except on a c++ project among other projects in an xcode (9.4.1) workspace. For that project, I noticed that only some breakpoints were working. Digging deeper showed that it was breakpoints made within private methods that did not work.

After a good deal of investigation, I found my particular issue. In my main project, I had declared some static objective-c initializers in a header file. Not entirely sure why, but after I moved these to the implementation file where they were referenced, my broken breakpoints started working again. Hope this saves someone some time.

Setting Build Active Architecture Only to Yes helps me.

在此处输入图片说明

  1. Set Deployment Postprocessing to "Yes" in my Build Settings for my target.
  2. Debug -> Debug Workflow -> Always show Disassembly -> Uncheck
  3. Quit Xcode and reopen the Xcode.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM