Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

How to debug androidNativeArm32/64 Target code? #3239

Closed
ZhouGongZaiShi opened this issue Aug 6, 2019 · 2 comments
Closed

How to debug androidNativeArm32/64 Target code? #3239

ZhouGongZaiShi opened this issue Aug 6, 2019 · 2 comments

Comments

@ZhouGongZaiShi
Copy link

The android project references the .so file produced by androidNativeArm32/64. If there is a problem with the native code, the following log will be printed:

2019-08-06 11:39:45.186 8640-8640/com.example.brotliandroid A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 8640 (e.brotliandroid), pid 8640 (e.brotliandroid)
2019-08-06 11:39:45.221 8663-8663/? I/crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
2019-08-06 11:39:45.221 639-639/? I//system/bin/tombstoned: received crash request for pid 8640
2019-08-06 11:39:45.222 8663-8663/? I/crash_dump64: performing dump of process 8640 (target tid = 8640)
2019-08-06 11:39:45.222 8663-8663/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-08-06 11:39:45.222 8663-8663/? A/DEBUG: Build fingerprint: 'google/angler/angler:8.1.0/OPM1.171019.011/4448085:user/release-keys'
2019-08-06 11:39:45.222 8663-8663/? A/DEBUG: Revision: '0'
2019-08-06 11:39:45.222 8663-8663/? A/DEBUG: ABI: 'arm64'
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG: pid: 8640, tid: 8640, name: e.brotliandroid  >>> com.example.brotliandroid <<<
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x0   0000000000000000  x1   00000000000021c0  x2   0000000000000006  x3   0000000000000008
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x4   0000000080000080  x5   0000000080000080  x6   0000000080000080  x7   8000008000000000
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x8   0000000000000083  x9   0000000010000000  x10  0000007fdf8ce550  x11  0000000000000001
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x12  0000007fdf8cde98  x13  0000000000000000  x14  ffffffffffffffff  x15  000b1a79e3a111d5
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x16  0000005558288fa8  x17  000000717b4ce4b8  x18  0000000000000000  x19  00000000000021c0
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x20  00000000000021c0  x21  0000000000000083  x22  0000007fdf8ce8bc  x23  00000070e1d3dded
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x24  0000000000000008  x25  000000717c7f6a40  x26  00000070f7cbeaa0  x27  0000000000000002
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     x28  0000000000000001  x29  0000007fdf8ce590  x30  000000717b4836ec
2019-08-06 11:39:45.223 8663-8663/? A/DEBUG:     sp   0000007fdf8ce550  pc   000000717b483714  pstate 0000000060000000
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG: backtrace:
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG:     #00 pc 000000000001d714  /system/lib64/libc.so (abort+120)
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG:     #01 pc 000000000003bd94  /data/app/com.example.brotliandroid-4-W3a8KIkuACeJgLiomiUQ==/lib/arm64/libbrotli-kn.so
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG:     #02 pc 000000000003c27c  /data/app/com.example.brotliandroid-4-W3a8KIkuACeJgLiomiUQ==/lib/arm64/libbrotli-kn.so
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG:     #03 pc 0000000000028af4  /data/app/com.example.brotliandroid-4-W3a8KIkuACeJgLiomiUQ==/lib/arm64/libbrotli-kn.so (Java_dec_DecoderJNITest_nativeCreate+116)
2019-08-06 11:39:45.225 8663-8663/? A/DEBUG:     #04 pc 000000000000f0b8  /data/app/com.example.brotliandroid-4-W3a8KIkuACeJgLiomiUQ==/oat/arm64/base.odex (offset 0xf000)

Even if I use addr2line I don't get the number of rows.

cd ~/.konan/dependencies/target-toolchain-21-linux-android_arm64/bin/
./aarch64-linux-android-addr2line -fe ~/work_dir/work_code/brotli-project/brotli-kotlin-native/build/bin/arm64/debugShared/libbrotli_kotlin_native.so  000000000003c27c 0000000000028af4 

TerminateWithUnhandledException
:?
Java_dec_DecoderJNITest_nativeCreate
:?

Please tell me how to get the number of rows in the error stack, or other debugging ways?? Thank you!

@ZhouGongZaiShi ZhouGongZaiShi changed the title How to debug androidNativeArm32 Target code? How to debug androidNativeArm32/64 Target code? Aug 6, 2019
@KotlinGeekDev
Copy link

Hello @ZhouGongZaiShi . I think this blog post can be of help.
Link : https://proandroiddev.com/debugging-native-crashes-in-android-apps-2b86fd7113d8.

@SvyatoslavScherbina
Copy link
Collaborator

Looks irrelevant to Kotlin/Native.
Feel free to submit new issue to YouTrack if you encounter a bug or would like to request a feature specific to Kotlin/Native, or please use StackOverflow or Kotlin Slack to get some help otherwise.
See more details: #4079

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants