gpt4 book ai didi

Xcode - 异常中断,但没有可用的符号

转载 作者:行者123 更新时间:2023-12-01 05:21:09 26 4
gpt4 key购买 nike

我需要帮助找出在 LLDB 中获取可用信息所需的魔法咒语。

我正在尝试调试一些奇怪的行为,我可以可靠地重现该问题,但我还不了解根本原因。我注意到有一个异常被抛出,所以我在 Xcode 中添加了一个异常断点。

异常(exception):

CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. *** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds for empty array with userInfo (null)



所以,有了我的断点,我得到了以下堆栈跟踪:

StackTrace

这看起来 super 有用!对于可重用的标题 View ,UICollectionViewFlowLayout 看起来有些古怪……现在我只需要……哦。废话。等待。什么?

如何检查堆栈跟踪的第 1 帧中使用超出范围的索引调用的数组?我可以在控制台中的 po <some memory address> 进行检查吗? I cannot use frame variable in the LLDB console when Frames 11 - 1 are selected ( from here ).

我阅读此堆栈跟踪的方式是:
  • (第 14 帧)获取的结果 Controller 已获取托管对象上下文更改,并将其称为委托(delegate)
  • (第 13 帧)FRC 委托(delegate),FHMemberDirectory 的一个实例,将消息 -memberDirectoryDidChangeContent:completion: 发送到 View Controller FHMemberDirectoryViewController,它是 UICollectionViewController 的子类
  • (第 12 帧) View Controller 在其 UICollectionView 实例上调用 -performBatchUpdates:completion:
  • (Frames 10 - 1) Private Apple 的东西碰巧尝试在屏幕上布局 Collection View ;我认为!

  • ...如果我错过了一些明显的东西,请告诉我!这个问题是关于调试的,我希望另一双眼睛或更多的专业知识可以启发我。

    在我未经训练的眼中,这似乎是隐藏在 Apple 代码中的一个错误,但我仍然需要想办法解决它。我的问题的要点是了解如何在不受我直接控制的代码中从 LLDB 控制台获取有用信息。

    最佳答案

    根据我的实验和研究,答案是:

    With LLDB alone, you cannot get useful symbols or memory addresses to inspect.



    但是,您可以使用 Objective-C 运行时来调整方法实现并跳转到深度堆栈跟踪,从而为您提供参数和返回值的句柄。

    stack trace with methods swizzled in

    现在我可以访问在第 3 帧和第 5 帧传入的参数了!

    (事实证明 ...usingData: 的论点是一个私有(private) Apple 类(class)。我能够挖掘更多关于类(class) here 的信息,但没有什么 super 有用的。在一天结束时,我提交了一个 radar 和寻求 DTS 解决方法的帮助)。

    关于Xcode - 异常中断,但没有可用的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16627158/

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