KeshaviPhone / plcrashreporter

Automatically exported from code.google.com/p/plcrashreporter
Other
0 stars 0 forks source link

CrashReporter does not show occurrence of exception #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Crash logs originating from a uncaught exception show the stack trace when the 
exception is being handled, and **not** when it was thrown. This reduces the 
helpfulness of exceptions like "-[__NSArrayI objectAtIndex:]: index 3 beyond 
bounds for empty array" to about zero.

Even CrashReporter 1.1beta1 does not help. Place something like this somewhere 
in your code:

    [[NSArray array] objectAtIndex: 3];

You will then get a crash log like this:

    0   libsystem_kernel.dylib              0x31dd032c __pthread_kill + 8
    1   libsystem_c.dylib                    0x30c8cfeb abort + 95
    2   Daedalus Beta                       0x000f2f43 uncaught_exception_handler + 27
    3   CoreFoundation                      0x000b9987 __handleUncaughtException + 75
    4   libobjc.A.dylib                     0x000092d1 _objc_terminate + 129
    5   libc++abi.dylib                     0x000043c5 safe_handler_caller(void (*)()) + 77
    6   libc++abi.dylib                     0x00004451 operator delete(void*) + 1
    7   libc++abi.dylib                     0x00005825 __cxa_current_exception_type + 1
    8   libobjc.A.dylib                     0x00009235 objc_exception_rethrow + 13
    9   CoreFoundation                      0x0000f545 CFRunLoopRunSpecific + 405
    10  CoreFoundation                      0x0000f3a5 CFRunLoopRunInMode + 105
    11  GraphicsServices                    0x00003fed GSEventRunModal + 157
    12  UIKit                               0x00031743 UIApplicationMain + 1091
    13  Daedalus Beta                       0x000023bb main (main.m:12)

Obviously, there is now a exception handler involved but it does not add any 
helpful information...

Original issue reported on code.google.com by maxseele...@googlemail.com on 19 Oct 2011 at 4:03

GoogleCodeExporter commented 9 years ago
The exception here was re-thrown, which results in the actual thread backtrace 
you see there. 1.1-beta1 also saves the original stack trace, if it's 
available, as a separate piece of information -- plcrashutil currently renders 
(in 1.1-beta1) this as an additional pseudo-thread.

What are you using to generate the text crash report?

Original comment by landon.j.fuller@gmail.com on 19 Oct 2011 at 4:06

GoogleCodeExporter commented 9 years ago
Hi Landon, I just realized that I had been using an outdated version of 
QuincyKit that was still doing manual crash report formatting as opposed to 
using yours. And hence, the new exception backtrace was not printed. The newer 
version uses your framework and everything is fine. Issue closed.

Just one note: I'd much prefer if you formatted the backtrack just like Apple 
does -- above all threads as a separate one:

    Date/Time:       2011-10-07 21:39:21.721 +0200
    OS Version:      iPhone OS 5.0 (9A334)
    Report Version:  104

    Exception Type:  EXC_CRASH (SIGABRT)
    Exception Codes: 0x00000000, 0x00000000
    Crashed Thread:  3

    Last Exception Backtrace:
    0   CoreFoundation                  0x373098bf __exceptionPreprocess + 163
    1   libobjc.A.dylib                 0x360e81e5 objc_exception_throw + 33
    ...

    Thread 0 name:  Dispatch queue: com.apple.main-thread
    Thread 0:
    0   libsystem_kernel.dylib
    ...

Thanks again, Max

Original comment by maxseele...@googlemail.com on 20 Oct 2011 at 8:04

GoogleCodeExporter commented 9 years ago
Here is a patch which changes the formatting to be identical to Apple format

- Andreas

Original comment by linde.andreas on 20 Oct 2011 at 1:09

Attachments:

GoogleCodeExporter commented 9 years ago
Awesome, thanks. I'll get this in shortly.

Original comment by landon.j.fuller@gmail.com on 20 Oct 2011 at 2:31

GoogleCodeExporter commented 9 years ago
Fixed in 9769caf

Original comment by landon.j.fuller@gmail.com on 1 Jan 2013 at 9:43