objective-c - Xcode:在调试中确定 xcode 中函数的调用者

标签 objective-c xcode swift

如何确定在调试状态下调用某个函数的位置?我陷入了 EXC_I386_GPFLT 错误,因此我不希望在我的测试用例中调用此类函数。

最佳答案

您可以尝试名为 Address Sanitizer 的 Xcode 7 新功能。

在 Xcode 中,转到产品 -> 方案 -> 编辑方案,选择运行,打开诊断选项卡并选中启用地址 sanitizer

Address sanitizer

然后Product -> Clean 项目并再次运行它。

Objective-C and C code is susceptible to memory corruption issues such as stack and heap buffer overruns and use-after-free issues. When these memory violations occur, your app can crash unpredictably or display odd behavior. Memory corruption issues are difficult to track down because the crashes and odd behavior are often hard to reproduce, and the cause can be far from the origin of the problem.

You enable the address sanitizer in the build scheme. Once enabled, added instrumentation is built into the app to catch memory violations immediately, enabling you to inspect the problem right at the place where it occurs. Other diagnostic information is provided as well, such as the relationship between the faulty address and a valid object on the heap and allocation/deallocation information, which helps you pinpoint and fix the problem quickly. The address sanitizer is efficient—fast enough to be used regularly as well as with interactive applications. It is supported in OS X, in the Simulator, and on iOS devices.

New features in Xcode 7

关于objective-c - Xcode:在调试中确定 xcode 中函数的调用者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33063902/

相关文章:

swift - 为什么打印对象的实例会使其陷入无限循环,并因错误 EXC_BAD_ACCESS 而崩溃?

ios - 如何下载 Vuforia 应用程序的数据集?

swift - 如何快速绘制一个复杂的圆?

arrays - 比较 2 个数组并列出差异 - Swift

ios - 如何使用 gcdasyncsocket 在 tls 连接中加载证书

ios - Objective-C:在文件中保存/还原复杂数据的数据结构?

iphone - 以编程方式生成 UIButtons 并将它们与 IBAction 相关联

ios - 如何从父 View 中关闭 SwiftUI NavigationView

iphone - 在 iPhone 上创建粒子最有效的方法是什么

objective-c - 带有 NSNumber 数组的 NSPredicate