I am trying to debug JNI code written in C running on Android 5. When one of my functions is called, I want to write a stack trace to the adb log so that I can see where the function was called from.
The first resources found showed that I needed to use libcorkscrew, and examples of using the library were included. Unfortunately, it seems that libcorkscrew has left Android 5, and now it is supposed to use libunwind. There are several problems for my project:
The instructions for getting libunwind in the project are sparse and / or misleading - some resources say that they download the project from github and build it (with instructions that do not work), others indicate that the library is already part of Android 5.
All examples are written in C ++, and it seems that libunwind has only C ++ bindings for functions inside it. Since my code is C, not C ++, and writing to a log function, not via stdlib C ++, this is not applicable.
In particular, I looked at the following pages:
Is there a way to get the stack trace in C code on Android 5 without program crashes?
source
share