0

「PLCrashReport」を使用してクラッシュ情報を収集し、アプリをより安定させようとしましたが、レポートは次のようになっています(コールスタックさえありません。どのように使用すると思いますか?):

「Exception:」の部分、Exception:(null):( null)、これは「exceptionName」と「exceptionReason」である必要があり、ほとんどの場合「null」です。理由はわかりませんが、通常の値が表示されることもありますが、Iあまり役に立たないと思います...

2009-11-13 23:43:04 +0800にクラッシュ-シグナルSIGSEGV(コードSEGV_ACCERR、アドレス= 0xffffffffc0f4186b)

  • 例外:(null):( null)-スレッド0:

    • クラッシュ:1
    • スタック(54フレーム):、\ n806128664、\ n 807756495、\ n 816280840、\ n 816247 068、\ n 817901396、\ n 807756495、\ n 816280840、\ n 817911108、\ n 816247068、\ n 816285160、\ n 816406620、\ n 807756495、\ n 806130012、\ n 119241、\ n 812165747、\ n 812164839、\ n 812379009、\ n 818127880、\ n 807885435、\ n 807923065、\ n 818122176、\ n 818130772、\ n 816625560、 \ n 816626608、\ n 816627024、\ n 816641892、\ n 816651496、\ n 816654628、\ n 816654224、\ n 146455、\ n 807923363、\ n 816119156、\ n 816119004、\ n 818227300、\ n 807923363、\ n 816119156、\ n 816119004、\ n 816524332、\ n 816525956、\ n 816521588、\ n 816212028、\ n 816151252、\ n 816147980、\ n 827758796、\ n 827769116、\ n 837343488、\ n 821391952、\ n 807840887、 \ n 807836793、\ n 807834407、\ n 827752032、\ n 816118388、\ n816157144、\ n 20421
4

2 に答える 2

3

スタックトレースとは何ですか?

メソッドの1つが呼び出されるたびに、これがスタックに置かれます。スタックトレースは、アプリがクラッシュしたクラスとメソッドを見つける方法であり、多くの場合、バグを1行に絞り込みます。

もちろん、これを行うには、16進数の負荷全体ではなく、スタックトレースが読み取り可能である必要があります。

atosをチェックしてください。

これが再び発生するのを防ぐために、atosを使用してこのコールスタックを解釈できます。これらの数値を意味のあるメソッドに変換する方法の説明とコードについては、CocoaDevwikiのスタックトレースページを参照してください。

これをクラッシュレポーターと統合する方法を理解する必要があります。UKCrashReporterを使用し、Uliのコードを変更して、キャッチされない例外が発生した場合に、読み取り可能なスタックトレースをクラッシュレポートに追加するようにしました。

コードサンプル

ESStackTraceクラスからインスピレーションを得て、次のようにしています。

-(void)logAndSaveStackTrace {
    NSString *stackTrace = [[self userInfo] objectForKey:NSStackTraceKey];
    NSString *atosCommand;
    if (stackTrace) {
        // If the stack trace key is present, pull out the addresses and convert to method names using atos.
        atosCommand = [NSString stringWithFormat:@"/usr/bin/atos -p %d %@ | tail -n +3 | head -n +%d | c++filt | cat -n",
                         [[NSProcessInfo processInfo] processIdentifier],
                         stackTrace,
                         ([[stackTrace componentsSeparatedByString:@"  "] count] - 4)];

    } else {
        // If there isn't a stack trace key or it's nil, try and work out the stack using the internal callStackReturn addresses method.
        NSArray *stackTraceArray = [self callStackReturnAddresses];
        atosCommand = [NSString stringWithFormat:@"/usr/bin/atos -p %d %@",
                       [[NSProcessInfo processInfo] processIdentifier],
                       [stackTraceArray componentsJoinedByString:@" "]];
    }

    NSString *readableStackTrace = [ShellTask executeShellCommandSynchronously:atosCommand];

    NSString *exceptionMessageForCrashReport = [NSString stringWithFormat:@"An exception of type %s occured.\n%s\nStack trace:\n%@", 
                                                [[self name] cStringUsingEncoding:NSUTF8StringEncoding], 
                                                [[self reason] cStringUsingEncoding:NSUTF8StringEncoding],
                                                readableStackTrace];

    [[NSUserDefaults standardUserDefaults] setObject:exceptionMessageForCrashReport forKey:@"uncaughtExceptionReport"];
    [[NSUserDefaults standardUserDefaults] synchronize];

    // Log the exception to the console too.
    NSLog(@"%@", exceptionMessageForCrashReport);
}

依存関係アホイ!

もちろん、このアプローチの問題の1つは、atosへの依存関係を導入していることです。10.5以降に標準でインストールされているとのことですが、間違っている可能性があります。最終的には、アプリが見つからない場合にatosを追加する小さなインストーラーを作成します。

于 2009-12-03T08:26:49.767 に答える
1

私はそれを使用していませんが、レジスターまですべてを取り出したセグメンテーション違反があったため、詳細がわからないと確信しています。PLCrashReportインスタンスは、他のすべてと一緒に停止したため、レポートできません。

PLCrashReportインスタンスはアプリケーション自体の中で実行されるため、アプリが完全にダウンした場合、詳細はわかりません。

于 2009-11-13T20:46:41.533 に答える