如何确定在调试状态下调用某个函数的位置?我陷入了 EXC_I386_GPFLT 错误,因此我不希望在我的测试用例中调用此类函数。
最佳答案
您可以尝试名为 Address Sanitizer
的 Xcode 7 新功能。
在 Xcode 中,转到产品 -> 方案 -> 编辑方案
,选择运行
,打开诊断
选项卡并选中启用地址 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.
关于objective-c - Xcode:在调试中确定 xcode 中函数的调用者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33063902/