Issue
I'm trying to debug an unreal engine 4 native application (a game I made). Sometimes I see a "tombstone" is generated when the game crashes. But not always ...
Is there any way to enforce tombstones generation? why it isn't generated everytime my game crashes?
Thanks in advance
Solution
The dumps are created by debuggerd when a program crashes under Linux. When this happens, the kernel will send a signal to the dying program. This signal is caught by a special signal handler installed in every native Android application by the bionic C library (this is why tombstones aren't generated for Java-based Android apps). The signal handler contacts debuggerd (via a named pipe), which then connects back to the dying program using ptrace to read registers and memory to produce the tombstone and log entries.
./bionic/linker/debugger.cpp
installs the debuggerd_signal_handler()
signal handler for several signals that when invoked will try to use the pipe to communicate to debuggerd to create the tombstone file. I suppose that if the pipe communication fails or the ptrace back to the crashing process fails then the tombstone won't be generated. But those failures should still be logged (in the tombstone file or logcat or maybe both - I'm not sure). There may be other problems that result in a tombstone file not being generated.
See the following for how the signal handling is set up by the bionic linker (all function names and files mentioned here are from Android 4.4, but should be similar in other versions):
__linker_init_post_relocation()
in./bionic/linker/linker.cpp
debuggerd_init()
in./bionic/linker/debugger.cpp
debuggerd_signal_handler()
in./bionic/linker/debugger.cpp
And see the following for how debuggerd
responds to the request to deal with a crashing process:
do_server()
in./system/core/debuggerd/debuggerd.c
// opens the pipe to receive requestshandle_request()
in./system/core/debuggerd/debuggerd.c
// handles the request to deal with a crashing process
Answered By - Michael Burr
Answer Checked By - Senaida (JavaFixing Volunteer)