如何找到哪个方法导致NDK堆栈跟踪崩溃

时间:2017-11-15 06:55:38

标签: android c android-ndk stack-trace

我的应用因.so文件而崩溃 我点了这个链接https://developer.android.com/ndk/guides/ndk-stack.html
使用上面的链接,我可以从log cat中获取堆栈跟踪转储 从堆栈跟踪中,它使用 ndk-stack工具向我显示所有函数名称。
但是我无法确定哪种方法确实导致我的应用程序崩溃?

这是我的应用程序中记录致命信号的日志。

id: 26940, tid: 27543, name: Thread-579  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34

它说明故障地址为0x34。但是使用ndk-stack工具它会显示所有带有功能名称的线程,但哪一个引起了崩溃?

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 26940, tid: 27543, name: Thread-579  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155638  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_thread_create at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:570 (discriminator 5)
Stack frame #01 pc 0011973f  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:667 (discriminator 2)
Stack frame #02 pc 00155471  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:214 (discriminator 2)
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 28169, tid: 28422, name: Thread-618  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155638  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_thread_create at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:570 (discriminator 5)
Stack frame #01 pc 0011973f  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:667 (discriminator 2)
Stack frame #02 pc 00155471  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:214 (discriminator 2)
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 29519, tid: 30349, name: Thread-620  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 10036, tid: 10963, name: Thread-755  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 11338, tid: 11813, name: Thread-751  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 12197, tid: 12384, name: Thread-801  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-2/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 14140, tid: 14798, name: Thread-808  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

********** Crash dump: **********
Build fingerprint: 'Xiaomi/land/land:6.0.1/MMB29M/V8.5.4.0.MALMIED:user/release-keys'
pid: 15644, tid: 16119, name: Thread-839  >>> com.nexge.nexgeotpdialer <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x34
Stack frame #00 pc 00155660  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (pj_thread_destroy+3): Routine pj_enter_critical_section at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:1094
Stack frame #01 pc 00119763  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (start_signal+238): Routine check_rx_late_pkt at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjmedia/build/../src/pjmedia/compressed_rtp.c:672
Stack frame #02 pc 00155499  /data/app/com.nexge.nexgeotpdialer-1/lib/arm/libpjsua2.so (thread_main+40): Routine pj_init at /home/protocol/Jeeva/PJSIPWorks/AESEncryption/pjlib/build/../src/pj/os_core_unix.c:218
Stack frame #03 pc 0004185b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
Stack frame #04 pc 000192a5  /system/lib/libc.so (__start_thread+6)
Crash dump is completed

1 个答案:

答案 0 :(得分:0)

我也在寻找跟踪SIGSEGV故障的方法。我决定做自己的踪迹。 https://github.com/claytonfan/trace 预期用途:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include "trace.h

void sig_handler(int signo)
{
    if( signo ==  SIGSEGV ) {
        traceDump("Signal SIGSEGV");
    }
    // may handle other signo's
    exit( signo );
}

int main(int argc, char **argv)
{
    traceInit( "Prgram Test", &printf, 0 );
    signal( SIGSEGV, sig_handler );
    //
    // and possibly other signals
    //
    // . . . main() logic . . .
    return( 0 );
}

希望有所帮助。

相关问题