mindsnacks/KSCrash — pull request #1 by kstenerud (2013-06-05 17:38:08+00:00)
Title: Feature/custom stacktrace

Added support for user-defined exceptions and stack traces.

With this new API, users can report their own exceptions and provide custom stack traces. This is particularly useful for capturing exceptions and stack traces from scripting languages.

In an Apple-style report, it would look like this:

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

Application Specific Information:
*** Terminating app due to uncaught exception 'Script Error', reason: 'fragment is not defined'

Custom Backtrace:
Line: string.append(fragment)
Printer.script, line 174: in function assembleComponents
Printer.script, line 209: in function print
Main.script, line 10: in function initialize

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 Crash-Tester 0x00049c61 0x1000 + 298081 (kscrashsentry_reportUserException + 145)
1 Crash-Tester 0x00035192 0x1000 + 213394 (kscrash_reportUserException + 98)
2 Crash-Tester 0x0000bbbf 0x1000 + 43967 (-[KSCrash reportUserException:reason:lineOfCode:stackTrace:terminateProgram:] + 399)
3 Crash-Tester 0x0000a5ec 0x1000 + 38380 (-[Crasher userDefinedCrash] + 252)
4 Crash-Tester 0x00008ae8 0x1000 + 31464 (__32-[AppDelegate(UI) crashCommands]_block_invoke463 + 72)
5 Crash-Tester 0x00008da3 0x1000 + 32163 (-[CommandEntry executeWithViewController:] + 67)
6 Crash-Tester 0x0000948a 0x1000 + 33930 (-[CommandTVC tableView:didSelectRowAtIndexPath:] + 154)
7 UIKit 0x0016a285 0xaf000 + 766597 (-[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1194)
8 UIKit 0x0016a4ed 0xaf000 + 767213 (-[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 201)
9 Foundation 0x00b745b3 0xb69000 + 46515 (__NSFireDelayedPerform + 380)
10 CoreFoundation 0x01e8e376 0x1e43000 + 308086 (__CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22)
11 CoreFoundation 0x01e8de06 0x1e43000 + 306694 (__CFRunLoopDoTimer + 534)
12 CoreFoundation 0x01e75a82 0x1e43000 + 207490 (__CFRunLoopRun + 1810)
13 CoreFoundation 0x01e74f44 0x1e43000 + 204612 (CFRunLoopRunSpecific + 276)
14 CoreFoundation 0x01e74e1b 0x1e43000 + 204315 (CFRunLoopRunInMode + 123)
15 GraphicsServices 0x01e297e3 0x1e21000 + 34787 (GSEventRunModal + 88)
16 GraphicsServices 0x01e29668 0x1e21000 + 34408 (GSEventRun + 104)
17 UIKit 0x000baffc 0xaf000 + 49148 (UIApplicationMain + 1211)
18 Crash-Tester 0x000024ba 0x1000 + 5306 (main + 170)
19 Crash-Tester 0x000023c5 0x1000 + 5061 (start + 53)

Review:
* @JaviSoto
* @tonycosentini