在使用 LLDB 研究调试异常时,我发现了以下文章和线程,以及其他提供相同信息的文章和线程:
https://www.natashatherobot.com/xcode-debugging-trick/
当尝试这些变体时,我能得到的最好结果是一个 int :
(lldb) po $rax
106377751137688
Run Code Online (Sandbox Code Playgroud)
当将其插入 Xcode 内存查看器时,尝试将其作为基数 10 和十六进制值,那里似乎没有存储对象。我得到的结果是B8 0B 0C 16 01 00 00 00 03...肉眼可见的后面跟着零的结果。我尝试过像descriptionint 上那样调用方法,就好像它是一个地址一样,将其转换为NSException*,这会产生结果:
error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector. The process has been returned to the state before expression evaluation.
Run Code Online (Sandbox Code Playgroud)
最近对 LLDB 的更改是否会破坏预期的功能?我正在使用 Xcode 9.2 以及 swift 和 Objective-c 的组合。还值得注意的是,我没有objc_exception_throw在调用堆栈中看到该帧,而是__cxa_throw在第 0 帧处看到该帧,这就是我选择获取结果的帧。
我正在查看的异常是通过调用生成的-[UIStoryboard instantiateViewControllerWithIdentifier:] …