Call exit instead of _exit when compiled with clang coverage
A function is registered with atexit when compiling with clang coverage. https://cs.android.com/android/platform/superproject/+/main:external/compiler-rt/lib/profile/InstrProfilingFile.c;l=508;drc=c58a43648cd6121c51a2e795a28e2ef90d7813e6 This function dumps coverage when the process exits. However when calling System.exit from java this leads to a call to _exit(2) which doesn't run exit hooks. Instead when compiled with coverage call exit(3) to run the exit hooks. This behavior is the same as what the default "exit" option of ART is doing. https://cs.android.com/android/platform/superproject/+/master:art/libartbase/base/fast_exit.h;l=44;drc=bdf1737bd17132525bcfdc778663123b61e97fa3 Another way to fix this might be to call __llvm_profile_write_file before _exit(2). Test: run avatar and see if coverage increase Bug: 304849228 Change-Id: Iec40612526f34472320be5ba5980cd1eea361ebc
Loading
Please register or sign in to comment