zoukankan      html  css  js  c++  java
  • iOS app exception的解决方案

    最近项目中总是碰到libsystem_kernel.dylib`__pthread_kill + 8, stop reason = signal SIGABRT

    类似于这样的错误,但是出现这样的错误之后总是无法定位问题具体的位置。

    (lldb) bt

    * thread #1: tid = 0x2403, 0x31c16350 libsystem_kernel.dylib`__pthread_kill + 8, stop reason = signal SIGABRT

        frame #0: 0x31c16350 libsystem_kernel.dylib`__pthread_kill + 8

        frame #1: 0x34fa5122 libsystem_c.dylib`pthread_kill + 58

        frame #2: 0x34fe1972 libsystem_c.dylib`abort + 94

        frame #3: 0x38101d4e libc++abi.dylib`abort_message + 74

        frame #4: 0x380ff0da libc++abi.dylib`safe_handler_caller(void (*)()) + 174

        frame #5: 0x380ff114 libc++abi.dylib`std::terminate() + 20

        frame #6: 0x38100598 libc++abi.dylib`__cxa_rethrow + 88

        frame #7: 0x33e0f9d0 libobjc.A.dylib`objc_exception_rethrow + 12

        frame #8: 0x39e66f20 CoreFoundation`CFRunLoopRunSpecific + 456

        frame #9: 0x39e66d48 CoreFoundation`CFRunLoopRunInMode + 104

        frame #10: 0x382342ea GraphicsServices`GSEventRunModal + 74

        frame #11: 0x330a62f8 UIKit`UIApplicationMain + 1120

        frame #12: 0x0001174c XingVelo3`main + 152 at main.m:16

    方法一

    通过在Xcode的控制台里面打印具体的值

    主要命令是bt 或者thread backtrace

    1. If you're using gdb, use bt to print the backtrace

    2. If you're using lldb, use thread backtrace instead

    出现错误之后把信息打印出来,然后追踪具体的位置。但是仅仅这样还不够,很多信息看不到。

    方法二,设置exception breakpoint

    这个方法可以直接定位到出错的位置,非常强大,也是最近才发现的。

    添加exception break point的方法,下面是说明。

    If you're running your app out of Xcode, add an exception breakpoint. In the breakpoint navigator (command-6) hit the '+' at the very bottom left to add. This will pause execution on the line that throws the exception and allow you to inspect the current scope, stack, etc.

  • 相关阅读:
    20145307陈俊达《网络对抗》Exp6 信息搜集与漏洞扫描
    20145307陈俊达《网络对抗》Exp5 MSF基础应用
    微服务负载均衡 —— ribbon
    微服务注册与发现 —— eureka
    shiro
    unix网络编程——I/O多路复用之epoll
    unix网络编程——TCP套接字编程
    java异常处理及自定义异常的使用
    磁盘调度算法寻道问题
    关于mybatis的思考(3)——ResultMaps的使用
  • 原文地址:https://www.cnblogs.com/easonoutlook/p/2822913.html
Copyright © 2011-2022 走看看