'How can I produce a call chain of Android application layer function call to linux kernel system calls?

I have been trying to get behind the call chain of some of the android framework's app initiated termination functions such as System.exit(0), finish(), finishAndRemoveTask(), etc. I have used strace to find system level traces, for System.exit() function of android application layer, I believe the kernel system level signal is SigKill, as this claim is supported by the following strace log.

enter image description here

I wanted to get behind the system-level calls or signals behind other android application layer functions such as finish().

I have tried to use Android Studio's built-in debugger, however, that only gives me all the call chains in java API level. I wanted to debug and get the full call chain from java function to native C/C++ library calls to kernel system level calls. That is function X() in java calls function Y() in native C/C++ libraries and that calls system level function Z(). I need the call chain flow from X -> Y -> Z.

How can I achieve that? I have also tried simpleperf but that does not provide the complete call-graph from application layer to system level calls.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source