1

Recently, my app had a crash and it threw an error:

libc++abi.dylib: terminate_handler unexpectedly threw an exception
(lldb) bt
* thread #1: tid = 0x2e8eb, 0x38cf1dfc libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x38cf1dfc libsystem_kernel.dylib`__pthread_kill + 8
    frame #1: 0x38d6fd36 libsystem_pthread.dylib`pthread_kill + 62
    frame #2: 0x38c91908 libsystem_c.dylib`abort + 76
    frame #3: 0x37fce9c8 libc++abi.dylib`abort_message + 88
    frame #4: 0x37fe5e28 libc++abi.dylib`std::__terminate(void (*)()) + 148
    frame #5: 0x37fe58ae libc++abi.dylib`__cxa_rethrow + 102
    frame #6: 0x386abdd2 libobjc.A.dylib`objc_exception_rethrow + 42
    frame #7: 0x2ae0745c CoreFoundation`CFRunLoopRunSpecific + 632
    frame #8: 0x2ae071d2 CoreFoundation`CFRunLoopRunInMode + 106
    frame #9: 0x322050a8 GraphicsServices`GSEventRunModal + 136
    frame #10: 0x2e416fa0 UIKit`UIApplicationMain + 1440
  * frame #11: 0x0016c250 hatchpic`top_level_code + 72 at AppDelegate.swift:44
    frame #12: 0x0016c3a4 hatchpic`main + 48 at AppDelegate.swift:0

and it did not tell me where the error exactly happens.

What I ended up doing is to figure the problem out by tracking what actions I have taken and tracing back the error manually.

It's quite a frustrating work to do. So how to use lldb, or perhaps other ways than manual approach, to locate where the error exactly happens then?

donkey
  • 4,285
  • 7
  • 42
  • 68
  • Cover the edge of your desk with a soft tissue and start biting it. Working with late-alpha software like Swift can be annoying :-( – qwerty_so Feb 28 '15 at 13:47
  • Haha, it is a funny statement. However, will it likely be improved in future versions. This error above has occurred to me several times. I think it has to do with multi-threading. It is lost.. – donkey Mar 01 '15 at 21:58
  • You should have a look at the edge of my desk, or even my teeth ;-) I know that kind of problem and it drives me nuts all times. Only exit: tons of println. – qwerty_so Mar 01 '15 at 22:09

1 Answers1

0

A similar answer was posted here. You simply add an Exception breakpoint and you set the Exception type to c++. This will pause execution on the function that actually causes the crash.

Sylvan D Ash
  • 1,047
  • 13
  • 24