Skip to content

Instantly share code, notes, and snippets.

@gubatron
Created September 12, 2021 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gubatron/0246a72faff4a17f6cae5a497c38cd32 to your computer and use it in GitHub Desktop.
Save gubatron/0246a72faff4a17f6cae5a497c38cd32 to your computer and use it in GitHub Desktop.
How to isolate crashes with `ndk-stack` from `adb logcat` output

adb logcat | ndk-stack -sym <path to folder with .so files>

Example: adb logcat | ndk-stack -sym ~/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a

@gubatron
Copy link
Author

gubatron commented Sep 12, 2021

ndk-stack output looks like:

When parsing older adb logcat output and the current binary sha256 doesn't match

********** Crash dump: **********
Build fingerprint: 'att/v341u/v341u:10/QKQ1.200311.002/V341U_A1_210524:user/release-keys'
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#00 0x004072e4 /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#01 0x002b662c /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#02 0x002b5e3c /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#03 0x002d5cdc /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#04 0x002cc810 /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#05 0x001e9900 /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&)+564) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#06 0x001e950c /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (boost::asio::detail::scheduler::run(boost::system::error_code&)+216) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
WARNING: Mismatched build id for /Users/gubatron/workspace.frostwire/frostwire-jlibtorrent/swig/bin/release/android/armeabi-v7a/libjlibtorrent.so
WARNING:   Expected faef0ed5411652ecb89f4c688ce247e07eb1aab6
WARNING:   Found    288f7fa67a321e9369a5058ffd38d998fbe5c545
#07 0x0029a7e0 /data/app/com.frostwire.android-1qrSUSgSJQe56_CMIujH3A==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: faef0ed5411652ecb89f4c688ce247e07eb1aab6)
#08 0x000aa8bb /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: b638b588df5590a58c813e9e3a0c67dc)
#09 0x00061993 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: b638b588df5590a58c813e9e3a0c67dc)
Crash dump is completed

when it matches:

********** Crash dump: **********
Build fingerprint: 'att/v341u/v341u:10/QKQ1.200311.002/V341U_A1_210524:user/release-keys'
#00 0x00530390 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#01 0x003df638 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (libtorrent::aux::session_impl::reopen_listen_sockets(bool)+196) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#02 0x003dee48 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (libtorrent::aux::session_impl::init()+656) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#03 0x003fed1c /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (_ZN10libtorrent3aux12session_impl4wrapIMS1_FvvEJEEEvT_DpOT0_+48) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#04 0x003f5844 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#05 0x00312928 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (boost::asio::detail::scheduler::do_run_one(boost::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost::asio::detail::scheduler_thread_info&, boost::system::error_code const&)+564) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#06 0x00312534 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (boost::asio::detail::scheduler::run(boost::system::error_code&)+216) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#07 0x003c37d8 /data/app/com.frostwire.android-kEuaGbL37j6DPSvL3wDByQ==/base.apk!libjlibtorrent.so (offset 0xf28000) (BuildId: 288f7fa67a321e9369a5058ffd38d998fbe5c545)
                                                                                                    ??
                                                                                                    ??:0:0
#08 0x000aa8bb /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: b638b588df5590a58c813e9e3a0c67dc)
#09 0x00061993 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: b638b588df5590a58c813e9e3a0c67dc)
Crash dump is completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment