【问题标题】:Why can’t I run Xcode debugger highlighting the call stack after a crash/exception?为什么我不能在崩溃/异常后运行 Xcode 调试器突出显示调用堆栈?
【发布时间】:2010-08-02 02:34:17
【问题描述】:

所以,在开发时,我在 iPhone 模拟器中运行应用程序时遇到了崩溃。在控制台中说这样的话...

2010-08-01 19:28:04.228 FakeCreme[32888:207] adding bucket: (null)
2010-08-01 19:28:04.230 FakeCreme[32888:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02641919 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0278f5de objc_exception_throw + 47
    2   CoreFoundation                      0x0263b571 -[__NSArrayM insertObject:atIndex:] + 225
    3   CoreFoundation                      0x026369c4 -[__NSArrayM addObject:] + 68
    4   FakeCreme                           0x0000b645 -[BucketsTable didReceiveEvents:withVerb:forDomain:] + 557
    5   FakeCreme                           0x0002e2fa -[EventManager addObject:withVerb:inDomain:] + 3206
    6   FakeCreme                           0x0000a7a8 -[BucketsTable viewDidLoad] + 1389
    7   UIKit                               0x003cac26 -[UIViewController view] + 179
    8   UIKit                               0x003c9050 -[UIViewController contentScrollView] + 42
    9   UIKit                               0x003d8df7 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    10  UIKit                               0x003d74ff -[UINavigationController _layoutViewController:] + 43
    11  UIKit                               0x003d8789 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
    12  UIKit                               0x003d3329 -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    13  UIKit                               0x004ee209 -[UILayoutContainerView layoutSubviews] + 226
    14  QuartzCore                          0x040e50d5 -[CALayer layoutSublayers] + 177
    15  QuartzCore                          0x040e4e05 CALayerLayoutIfNeeded + 220
    16  QuartzCore                          0x040e464c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 302
    17  QuartzCore                          0x040e42b0 _ZN2CA11Transaction6commitEv + 292
    18  UIKit                               0x0032563f -[UIApplication _reportAppLaunchFinished] + 39
    19  UIKit                               0x00325a68 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 545
    20  UIKit                               0x0032f452 -[UIApplication handleEvent:withNewEvent:] + 1958
    21  UIKit                               0x00328074 -[UIApplication sendEvent:] + 71
    22  UIKit                               0x0032cac4 _UIApplicationHandleEvent + 7495
    23  GraphicsServices                    0x02cbbafa PurpleEventCallback + 1578
    24  CoreFoundation                      0x02622dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    25  CoreFoundation                      0x02583737 __CFRunLoopDoSource1 + 215
    26  CoreFoundation                      0x025809c3 __CFRunLoopRun + 979
    27  CoreFoundation                      0x02580280 CFRunLoopRunSpecific + 208
    28  CoreFoundation                      0x025801a1 CFRunLoopRunInMode + 97
    29  UIKit                               0x00325226 -[UIApplication _run] + 625
    30  UIKit                               0x00330b58 UIApplicationMain + 1160
    31  FakeCreme                           0x000025a0 main + 102
    32  FakeCreme                           0x00002531 start + 53
    33  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

(崩溃的细节无关紧要,只是一个插图。)

现在,当我遇到这样的崩溃时,我可以运行 Xcode 调试器并方便地在其中加载调用跟踪,以便调试器加载调用堆栈,并且我可以交互地在方法中导航当时就被叫了。

但自从安装 Xcode 3.2.3 和/或切换计算机后,这不起作用。我在我的应用程序停止的时候加载调试器,但它是空的,没有调用堆栈。

我确定我在某处遗漏了 Xcode 设置,但我自己快速浏览设置并没有找到任何东西。此时我需要做什么才能在调试器中加载调用堆栈?

【问题讨论】:

    标签: xcode debugging


    【解决方案1】:

    有时,由于某种原因,XCode 调试器会停止在无法获取调试值的地方。我在尝试停止动画回调时看到了它。没有一个设置可以让你真正选择来解决这个问题(尽管你应该检查你是在 Debugn 中运行而不是在 Release 中运行,并且仍然在项目设置中检查了调试符号的生成)。

    您可以尝试在 XCode 4 中使用 LLVM 调试器。

    但是,为了解决您的特定问题 - 您似乎很清楚您正在尝试将一个对象插入到 BucketsTable 中 +didReceiveEvents:WithVerb:ForDomain: 中的数组中,您在其中的最后一个元素之后插入了一些点太远大批。您可以尝试使用 NSLog 围绕任何带有索引和对象值的数组插入。

    【讨论】:

    • 是的,对于这个特殊的问题,我可以很容易地用控制台解决它,我的问题更多的是一般性,有一段时间没有看到调试器让我调试崩溃了。
    • @Jaanus 不幸的是,LLVM 调试器不适用于 iOS 调试:stackoverflow.com/questions/4908805/…
    • 很抱歉 - 它曾经是早期的测试版。
    猜你喜欢
    • 2011-08-05
    • 1970-01-01
    • 2013-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-31
    • 2012-03-05
    • 1970-01-01
    相关资源
    最近更新 更多