Xcode 4.x - 使它指向违规的崩溃线 [英] Xcode 4.x - making it point to the offending crashing line

查看:232
本文介绍了Xcode 4.x - 使它指向违规的崩溃线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次Xcode崩溃时,它指向main.m上的这一行。

  int retVal = UIApplicationMain(argc,argv,nil ,@AppController); 

我知道Xcode 4调试臭的比较3.x,但是如何让它指向



请不要:


  1. 告诉我以启用NSZombieEnabled;

  2. 告诉我添加一个异常断点来为Catch或Throw上的所有异常打破。

  3. 告诉我Xcode 4.x

  4. $ b

    所有这些东西都是无用的或者几乎没用,Xcode继续在同一行上崩溃。 main.m ...



    请保存我。



    谢谢。 $ b

    解决方案

    这里有一个想法:只需要在整个应用程序中执行一次try / catch,就可以从异常 堆栈(即不是断点+检查):



    main.m

      int main(int argc,char * argv [])
    {
    @autoreleasepool {
    @try {
    return UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate class])));
    }
    @catch(NSException * exception){
    NSLog(@%@,[exception callStackSymbols]);
    return 1;
    }
    }
    }

    我的理解是,我们没有一个好的方法,否则是崩溃本身不会发生,直到后来在runloop。我认为像未捕获的异常等东西只是把应用程序的状态,它会在Apple的代码中的某个地方,当runloop迭代。这类似于如果您在UI中发生崩溃...在您设置侏儒几何时,它并不总是崩溃,它尝试使用时崩溃。因此,我们需要从异常对象中获取堆栈,而不是在崩溃实际发生时从当前状态获取堆栈。



    它让我几次,当我认为我没有信息,但我只是不知道Xcode足够好(我相信它的常识,我只是愚蠢)。有时当我认为我所有的是那个可怕的顶级作用域,我需要做的是使用左下角的小滑块(在调试会话期间)来查看整个堆栈。这通常几乎没有用,因为上面提到的原因(它在runloop的另一部分从问题)。





    Every time Xcode crashes it points to this line on main.m

    int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
    

    I know Xcode 4 debugging stinks compared to 3.x, but how do I make it point to the line where the crash happened.

    Please don't:

    1. Tell me to enable NSZombieEnabled;
    2. Tell me to add an exception breakpoint to break for all exceptions on Catch or on Throw.
    3. Tell me Xcode 4.x is better than 3.x for debugging.

    All this stuff is useless or barely useless and Xcode continues to crash on the same line on main.m...

    Please save me from this.

    Thanks.

    解决方案

    Here's an idea: just one try/catch around your entire app, logging the stack from the exception, not the current stack (i.e. not a breakpoint + inspection):

    main.m

    int main(int argc, char *argv[])
    {
        @autoreleasepool {
            @try {
                return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
            }
            @catch (NSException *exception) {
                NSLog(@"%@",[exception callStackSymbols]);
                return 1;
            }
        }
    }
    

    My understanding is that the reason we don't have a good method otherwise is that the crash itself does not happen until later in the runloop. I think things like uncaught exceptions, etc. just put the app in a state where it will crash somewhere in Apple's code when the runloop iterates. This is similar to if you ever have crashes in the UI... it doesn't always crash when you set the crappy geometry, it crashes when it tries to use it. For this reason, we need to get the stack from the exception object, not from the current-state when the crash actually occurs.

    And I'll add this just because it got me a few times when I thought I had no info available, but I just didn't know Xcode well enough yet (I'm sure it's common knowledge and I was just being silly). Sometimes when I think that all I have is that dreaded top-level scope, all I needed to do was use the little slider at bottom-left (during debug sessions) to see the whole stack. This is often nearly useless, for the reasons mentioned above (it's in another part of the runloop from the problem).

    这篇关于Xcode 4.x - 使它指向违规的崩溃线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆