ios - 如何在 Xcode 6 中的异常断点处打印异常?

标签 ios objective-c xcode

我的应用程序崩溃了,它似乎陷入了异常断点(这是有道理的),但我无法找到崩溃的原因。

这是我尝试过的:

  • po $eax
  • po $rax
  • po $r0
  • po *(id *)($esp + 4)

对于上述所有尝试,我都收到以下错误:

error: use of undeclared identifier '$<register name>' error: 1 errors parsing expression

我也找到了这个LLDB Command Guide , 但没有找到任何有用的东西(有点令人困惑,你不知道你在找什么)。

如何打印崩溃原因?

我正在运行 iOS 8、lldb 和 Xcode 6。

编辑

现在我明白为什么找不到这些寄存器了。这是我运行 register read 时得到的结果:

General Purpose Registers:
x0 = 0x0000000000000001
x1 = 0x0000000000000000
x2 = 0x0000000000000000
x3 = 0x0000000195531a74  libsystem_malloc.dylib`nano_free_definite_size
x4 = 0x0000000000000000
x5 = 0x0000000000000000
x6 = 0x676e697274534643
x7 = 0x0000000000000f80
x8 = 0x00000001569d5a10
x9 = 0x0000000000000000
x10 = 0x000001a574056051
x11 = 0x0000000000000001
x12 = 0x000000000000003d
x13 = 0x0000000000000000
x14 = 0x0000000000000001
x15 = 0x0000000000000052
x16 = 0x0000000194d6e510  libobjc.A.dylib`object_setClass
x17 = 0x0000000000000000
x18 = 0x0000000000000000
x19 = 0x00000001702823f0
x20 = 0x0000000174038eaa
x21 = 0x000000019130a778  "release"
x22 = 0x0000000000000000
x23 = 0x0000000174246d20
x24 = 0x0000000174038ea0
x25 = 0x00000001895d22fa  "forwardingTargetForSelector:"
x26 = 0x00000001745186a0
x27 = 0x0000000000000000
x28 = 0x00000000a40008ff
fp = 0x0000000105757720
lr = 0x000000018462a440  CoreFoundation`___forwarding___ + 968
sp = 0x00000001057576c0
pc = 0x000000018462a440  CoreFoundation`___forwarding___ + 968
cpsr = 0x20000000

如您所见,这些是使用的寄存器,不包含我之前尝试过的任何寄存器。但是,我仍然找不到异常。

xcode view

最佳答案

你应该只输入:

po $arg1

有关更多信息,请参阅:How to replace NSUncaughtExceptionHandler with definition in Breakpoint navigator?

关于ios - 如何在 Xcode 6 中的异常断点处打印异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28815186/

相关文章:

SwiftUI AspectRatio 不适用于来自相机的图像

iOS 企业应用程序和备份到新设备

ios - 可扩展单元格不会扩展

ios - 未调用 UIAlertAction 完成 block - iOS

iphone - iOS6 : do we have to set rootViewController in App delegate in order to support different orientations?

objective-c - CFUUIDBytes 潜在的 iOS 内存泄漏

ios - 堆栈 View 动画 - 折叠排列的 subview

ios - 捕获 UIScrollView 上的触摸

ios - 测量ios应用程序的内存使用情况

xcode - 从 Swift 客户端上的 TCP 服务器获取响应