在Xcode中没有命中断点(9.3)

时间:2021-04-20 20:43:55

None of my breakpoints are being hit.

我的断点都没有被击中。

I've tried the following:

我尝试过以下方法:

  • Deleted Derived Data directory
  • 删除派生数据目录

  • Cleaned build folder
  • 清理构建文件夹

  • Deleted the xcuserdata directory
  • 删除了xcuserdata目录

  • Made sure build configuration is Debug and Debug executable is ticked
  • 确保构建配置是Debug和Debug可执行文件

  • Made sure Generate debug symbols is set to Yes
  • 确保生成调试符号设置为是

  • Changed Optimization level to No optimization
  • 将优化级别更改为无优化

The breakpoints are still not being hit.

断点仍未被击中。

7 个解决方案

#1


12  

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编译器 - 代码生成子菜单下的优化级别。将它从-O移动到-Onone

在Xcode中没有命中断点(9.3)

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

#2


3  

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

我已在我的目标的构建设置中将部署后处理设置为NO。将此设置为YES使我的断点再次起作用。

#3


2  

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 linked product”的构建设置,对于发布和调试版本,它默认为“Yes”。通过将此设置为“否”进行调试构建(并进行完全重建),我的断点现在可以再次运行。

#4


1  

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

检查首选项>行为>正在运行>暂停选项。导航器和调试器的显示必须已勾选。

#5


0  

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初始化器。不完全确定原因,但是在我将它们移动到引用它们的实现文件之后,我的断点开始再次运行。希望这能节省一些时间。

#6


0  

Try below steps

尝试以下步骤

  1. Go to debug (top bar in Xcode)
  2. 转到调试(Xcode中的顶部栏)

  3. Debug Workflow
  4. Always show Disassembly - uncheck it
  5. 始终显示反汇编 - 取消选中它

#7


0  

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

我遇到了同样的问题,这个解决方案对我有用:

  • Open project settings
  • 打开项目设置

  • Optimization Level
  • Under "Swift Complier - Code Generation" Section
  • 在“Swift编译器 - 代码生成”部分下

  • Set "Optimization Level" to No Optimization[-Onone]
  • 将“优化级别”设置为“无优化”[-Onone]

Refer attached screen shot 在Xcode中没有命中断点(9.3)

请参阅随附的屏幕截图

#1


12  

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编译器 - 代码生成子菜单下的优化级别。将它从-O移动到-Onone

在Xcode中没有命中断点(9.3)

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

#2


3  

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

我已在我的目标的构建设置中将部署后处理设置为NO。将此设置为YES使我的断点再次起作用。

#3


2  

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 linked product”的构建设置,对于发布和调试版本,它默认为“Yes”。通过将此设置为“否”进行调试构建(并进行完全重建),我的断点现在可以再次运行。

#4


1  

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

检查首选项>行为>正在运行>暂停选项。导航器和调试器的显示必须已勾选。

#5


0  

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初始化器。不完全确定原因,但是在我将它们移动到引用它们的实现文件之后,我的断点开始再次运行。希望这能节省一些时间。

#6


0  

Try below steps

尝试以下步骤

  1. Go to debug (top bar in Xcode)
  2. 转到调试(Xcode中的顶部栏)

  3. Debug Workflow
  4. Always show Disassembly - uncheck it
  5. 始终显示反汇编 - 取消选中它

#7


0  

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

我遇到了同样的问题,这个解决方案对我有用:

  • Open project settings
  • 打开项目设置

  • Optimization Level
  • Under "Swift Complier - Code Generation" Section
  • 在“Swift编译器 - 代码生成”部分下

  • Set "Optimization Level" to No Optimization[-Onone]
  • 将“优化级别”设置为“无优化”[-Onone]

Refer attached screen shot 在Xcode中没有命中断点(9.3)

请参阅随附的屏幕截图