简体   繁体   中英

How to find which method caused crash from NDK stack trace

My app crashes due to .so file.
I followed this link https://developer.android.com/ndk/guides/ndk-stack.html
Using the above link i am able to take stack-trace dump from log cat.
And from stack trace it shows me all functions name using ndk-stack tool .
But i am unable to find out which method exactly caused my app to crash??

This is the log from my app stating fatal signal.

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

Its stating fault address 0x34.but using ndk-stack tool it shows all threads with function names but which one caused crash??

********** 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

I too was looking for ways to trace SIGSEGV faults. I decided to do my own trace. https://github.com/claytonfan/trace Intended usage:

#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 );
}

Hope that helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM