How to use ndk-stack in Android Studio?
Asked Answered
D

0

1

I need to debug my native C code. (I'm a newbie in C and ndk). I get this error, but i don't know exactly from where the bug come from:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38

I find some tool to do that, but the documentation is very unclear for me and I realy don't know how to use that. I tried command from documentation, but I have:

'$NDK' is not recognized as an internal or external command, operable program or batch file.

I tried replacing $NDK with ndk location and $PROJECT_PATH with my android studio project path, but then I get:

C: is not recognized as an internal or external command, operable program or batch file.

How can I get the place (human readable) from where the C signal comes from using Android Studio? I would be realy grateful if somebody gave me veryy detailed step by step guide (like for idiot) with example.
I've seen many similar questions like this or this, but I've not found them helpful.
Thanks in advance!

Full error looks like this:

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG: Cause: null pointer dereference
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x0  0000000000000000  x1  0000007fcbe612e8  x2  0000000000000000  x3  0000007fcbe612f4
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x4  0000007fcbe5fea0  x5  000000760d208470  x6  000000760d200100  x7  0000000000000001
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x8  3a081cfc2b057a9c  x9  3a081cfc2b057a9c  x10 0000000000430000  x11 0000007fcbe5fe20
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x12 0000007fcbe5fd00  x13 0000000000000010  x14 000000760d2188fc  x15 00000000ebad6a89
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x16 0000007587a487e8  x17 0000007fcbe611f0  x18 0000000000000000  x19 000000778106c380
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x20 0000000000000000  x21 000000778106c380  x22 000000792f0f3000  x23 000000778106c430
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x24 00000075eb871320  x25 00000076f106d510  x26 000000792f0f3000  x27 0000000000000d89
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     x28 0000007fcbe61200  x29 0000007fcbe61200
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:     lr  000000760d222248  sp  0000007fcbe611f0  pc  0000007587a487ec  pst 0000000060000000
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG: backtrace:
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:       #00 pc 00000000010757ec  /data/app/~~3Zs2OavC8p7AJpYYMbAsbw==/com.fivesoft.fivesfotstreamer-4yYlj4e5I5l3j1ng0knVeQ==/base.apk!libgstreamer_android.so
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:       #01 pc 0000000000222244  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 600193f4a9fcf9ced238223aee6c1164)
2022-04-11 14:47:00.618 28022-28022/? A/DEBUG:       #02 pc 0000000000218964  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 600193f4a9fcf9ced238223aee6c1164)
...
Discredit answered 5/4, 2022 at 20:31 Comment(1)
You should run ndk-stack from bash prompt, not in Windows shell. The best way to achieve this is to install Ubuntu on your Windows machine.Interment

© 2022 - 2024 — McMap. All rights reserved.