断点未在 Xcode (9.3) 中命中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49731369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Breakpoints not hit in Xcode (9.3)
提问by Questioner
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
andDebug executable
is ticked - Made sure
Generate debug symbols
is set toYes
- Changed
Optimization level
toNo optimization
- 删除派生数据目录
- 清理构建文件夹
- 删除了 xcuserdata 目录
- 确信构建配置是
Debug
和Debug executable
打勾 - 确保
Generate debug symbols
设置为Yes
- 改变
Optimization level
以No optimization
The breakpoints are still not being hit.
断点仍然没有被击中。
回答by geckojk
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. Move it from -O to -Onone
在 Swift Compiler - Code Generation 子菜单下更改优化级别。将它从 -O 移动到 -Onone
源代码:https: //www.reddit.com/r/swift/comments/89nht7/breakpoints_not_working_after_updating_to_xcode_93/?st =jftp4n02 &sh =49688058
回答by Milap Kundalia
Try below steps
尝试以下步骤
- Go to debug (top bar in Xcode)
- Debug Workflow
- Always show Disassembly - uncheck it
- 转到调试(Xcode 中的顶部栏)
- 调试工作流
- 始终显示反汇编 - 取消选中它
回答by turbomerl
I had set Deployment Postprocessing
to NO
in my Build Settings for my target. Setting this to YES
made my breakpoints work again.
我已经设定Deployment Postprocessing
到NO
为我的目标我的构建设置。将此设置为YES
使我的断点再次起作用。
回答by Reuben Scratton
None of the existing answers worked for me so I dug into what was going on. By forcing a breakpoint in code (i.e. an asm("int3;") instruction) I was able to see that the symbols weren't loading. Naturally breakpoints depend on symbol information being loaded.
现有的答案都不适合我,所以我深入研究了发生了什么。通过在代码中强制断点(即 asm("int3;") 指令),我能够看到符号没有加载。自然断点取决于加载的符号信息。
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.
我的断点不起作用的代码在 C++ 框架中,并且该框架有一个名为“ Strip links product”的构建设置,对于发布和调试构建,它默认为“Yes”。通过将调试版本设置为“否”(并进行完全重建),我的断点现在可以再次工作。
回答by Tarun Seera
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]
- 打开项目设置
- 优化级别
- 在“Swift 编译器 - 代码生成”部分下
- 将“优化级别”设置为无优化[-Onone]
回答by Negar Moshtaghi
Check Preferences > Behaviors > Running > Pauses options. The Show for navigator and debugger must have ticked.
检查首选项 > 行为 > 运行 > 暂停选项。导航器和调试器的显示必须已勾选。
回答by Alexander Ushakov
In my case problem was in the Debug information formatsetting. It was set to DWARF
instead of DWARF with dSYM File
. Reseting it to the default value solved the problem.
就我而言,问题出在调试信息格式设置中。它被设置为DWARF
而不是DWARF with dSYM File
。将其重置为默认值解决了问题。
回答by Venu Gopal Tewari
回答by iUrii
回答by Fernando Rodriguez
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.
以前的解决方案都不适合我。我有一个问题,除了 xcode (9.4.1) 工作区中的其他项目中的 c++ 项目外,我的所有断点都可以工作。对于那个项目,我注意到只有一些断点有效。深入挖掘表明,在私有方法中创建的断点不起作用。
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.
经过大量调查,我发现了我的特殊问题。在我的主要项目中,我在头文件中声明了一些静态的 Objective-c 初始值设定项。不完全确定为什么,但在我将这些移动到引用它们的实现文件后,我的断点又开始工作了。希望这可以节省一些时间。