[英]Breakpoints not hit in Xcode (9.3)
None of my breakpoints are being hit.我的断点都没有被击中。
I've tried the following:我尝试了以下方法:
Debug
and Debug executable
is tickedDebug
并勾选了Debug executable
Generate debug symbols
is set to Yes
Generate debug symbols
设置为Yes
Optimization level
to No optimization
Optimization level
更改为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).今天遇到了这个确切的问题 - Swift 项目中的断点在 XCode 9.3 中失败(objective-c 很好)。
The following fixed it:以下修复了它:
change Optimization level under the Swift Compiler - Code Generation submenu.
在 Swift Compiler - Code Generation 子菜单下更改优化级别。 Move it from -O to -Onone
将它从 -O 移动到 -Onone
src: https://www.reddit.com/r/swift/comments/89nht7/breakpoints_not_working_after_updating_to_xcode_93/?st=jftp4n02&sh=49688058源代码: https : //www.reddit.com/r/swift/comments/89nht7/breakpoints_not_working_after_updating_to_xcode_93/? st = jftp4n02 & sh =49688058
Try below steps尝试以下步骤
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.
通过在代码中强制断点(即 asm("int3;") 指令),我能够看到符号没有加载。 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.我的断点不起作用的代码在 C++ 框架中,并且该框架有一个名为“ Strip links product ”的构建设置,对于发布和调试构建,它默认为“Yes”。 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.我在目标的构建设置中将
Deployment Postprocessing
设置为NO
。 Setting this to YES
made my breakpoints work again.将此设置为
YES
使我的断点再次起作用。
In my case problem was in the Debug information format setting.就我而言,问题出在调试信息格式设置中。 It was set to
DWARF
instead of DWARF with dSYM File
.它被设置为
DWARF
而不是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:我遇到了同样的问题,这个解决方案对我有用:
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.
我有一个问题,除了 xcode (9.4.1) 工作区中的其他项目中的 c++ 项目外,我的所有断点都可以工作。 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.
在我的主要项目中,我在头文件中声明了一些静态的 Objective-c 初始值设定项。 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.
希望这可以节省一些时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.