gpt4 book ai didi

ios - 在 XCode 6.1.1 中调试 EXC_BAD_INSTRUCTION 崩溃

转载 作者:行者123 更新时间:2023-11-29 10:33:51 24 4
gpt4 key购买 nike

我最近在运行我的应用程序时遇到了以下错误:

EXC_BAD_INSTRUCTION (code=EXC_1386_INVOP, subcode=0x0)

如何调试此特定错误?还有其他方法我没试过吗?

这种特定的崩溃发生在我们打开聊天对话时 UITableView .这个UITableView的配置涉及几个元素,如已注册的 nib 加载 UITableView细胞以及在 dispatch_async 的帮助下将一些图像异步加载到这些细胞中

我尝试了一些常用的技巧来从调试器中获取更多有用的信息,但都没有成功:


启用 NSZombies

这似乎提供了有关任何线程(main 本身除外)中唯一可见函数调用的更多信息,之前是 +[ASIHTTPRequest runRequests]尽管我不太愿意相信真正的问题在于 ASIHttpRequest 的实现特别是因为我们多年来没有改变它......(我意识到这个库早就被弃用了)

enter image description here


执行 bt命令

正在运行 bt似乎提供了一些半有用的数据。它至少表明该问题可能与UITableView有关。配置。

(lldb) bt
* thread #1: tid = 0x854b7, 0x0503da6b libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0503da6b libobjc.A.dylib`objc_exception_throw
frame #1: 0x028fe86d CoreFoundation`+[NSException raise:format:] + 141
frame #2: 0x03998d7c QuartzCore`CA::Layer::set_position(CA::Vec2<double> const&, bool) + 190
frame #3: 0x03998f2a QuartzCore`-[CALayer setPosition:] + 56
frame #4: 0x039995a7 QuartzCore`-[CALayer setFrame:] + 752
frame #5: 0x03b4a20c UIKit`-[UIView(Geometry) setFrame:] + 305
frame #6: 0x03c85432 UIKit`-[UIImageView _setViewGeometry:forMetric:] + 228
frame #7: 0x03c8563a UIKit`-[UIImageView setFrame:] + 63
frame #8: 0x03b4c0cf UIKit`-[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] + 967
frame #9: 0x03b4ce11 UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 301
frame #10: 0x03b4ce9e UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 121
frame #11: 0x03b4b9ed UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 87
frame #12: 0x02824e33 CoreFoundation`__53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 99
frame #13: 0x028244cf CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
frame #14: 0x03b4b97d UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #15: 0x03be9df2 UIKit`-[UITableView resizeSubviewsWithOldSize:] + 98
frame #16: 0x03b4d13f UIKit`-[UIView(Geometry) setBounds:] + 537
frame #17: 0x03b6b2a7 UIKit`-[UIScrollView setBounds:] + 1071
frame #18: 0x03bea257 UIKit`-[UITableView setBounds:] + 260
frame #19: 0x03b4caae UIKit`-[UIView(Geometry) _applyISEngineLayoutValues] + 348
frame #20: 0x03b4cd6b UIKit`-[UIView(Geometry) _resizeWithOldSuperviewSize:] + 135
frame #21: 0x042a1fb6 UIKit`-[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] + 73
frame #22: 0x03b4ce9e UIKit`-[UIView(Geometry) resizeWithOldSuperviewSize:] + 121
frame #23: 0x03b4b9ed UIKit`__46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 87
frame #24: 0x02824e33 CoreFoundation`__53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 99
frame #25: 0x028244cf CoreFoundation`-[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239
frame #26: 0x03b4b97d UIKit`-[UIView(Geometry) resizeSubviewsWithOldSize:] + 149
frame #27: 0x04250c39 UIKit`-[UIView(AdditionalLayoutSupport) _is_layout] + 166
frame #28: 0x03b512bf UIKit`-[UIView(Hierarchy) _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 697
frame #29: 0x03b5137c UIKit`-[UIView(Hierarchy) layoutSubviews] + 57
frame #30: 0x03b5edd1 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 608
frame #31: 0x05053771 libobjc.A.dylib`-[NSObject performSelector:withObject:] + 70
frame #32: 0x039a228f QuartzCore`-[CALayer layoutSublayers] + 152
frame #33: 0x03996115 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 397
frame #34: 0x03995f70 QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 26
frame #35: 0x038f43c6 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 284
frame #36: 0x038f578c QuartzCore`CA::Transaction::commit() + 392
frame #37: 0x038f5e58 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92
frame #38: 0x028219de CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
frame #39: 0x02821920 CoreFoundation`__CFRunLoopDoObservers + 400
frame #40: 0x0281735a CoreFoundation`__CFRunLoopRun + 1226
frame #41: 0x02816bcb CoreFoundation`CFRunLoopRunSpecific + 443
frame #42: 0x028169fb CoreFoundation`CFRunLoopRunInMode + 123
frame #43: 0x067db24f GraphicsServices`GSEventRunModal + 192
frame #44: 0x067db08c GraphicsServices`GSEventRun + 104
frame #45: 0x03ad38b6 UIKit`UIApplicationMain + 1526


比较日志和审查提交

这就是我现在正在做的,但错误发生在一个不太常见的用例中,所以我们不确定它实际上是什么时候坏的。


设置内存调试器

我并没有最终需要这样做,但它可能对其他人有帮助。参见 Tim's answer下文了解更多详情。


提前感谢您的任何反馈/建议!

最佳答案

不幸的是,iOS 没有提供像样的内存调试器。您可以自己从源代码构建 clang 并创建自定义 Xcode 编译器来使用它。读一读 here .

完成后,如果您在 CFLAGSLFLAGS 中传递 -fsanitize=address,则 clang 将自动检查常见内存错误(如 Valgrind redux.)

我知道这是一项繁重的工作,但是一旦您设置好它,将它作为一种方便的工具会非常有帮助。

关于ios - 在 XCode 6.1.1 中调试 EXC_BAD_INSTRUCTION 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28099524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com