diff options
| author | 2023-10-13 11:45:00 +0000 | |
|---|---|---|
| committer | 2023-10-13 11:45:00 +0000 | |
| commit | cbd1bfb6730d7778bf60b6a1f11182ffc0f15890 (patch) | |
| tree | 809140084e735836577a0c91c81ee0e82f257cfd | |
| parent | cbff326cd0b478125caab167e03bce565af83e57 (diff) | |
| parent | 43183785da97fa57917a16458deca176cc62c597 (diff) | |
Merge "Call exit instead of _exit when compiled with clang coverage" into main am: 0c175e28e5 am: fa58b4a9c5 am: 32df7715e0 am: 79dc06e44c am: 43183785da
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2780904
Change-Id: I9affbede7282212cfa4d147aeb732e28716b7407
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | core/jni/AndroidRuntime.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index b5d70d379e0c..50253cf9e457 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -1315,7 +1315,16 @@ void AndroidRuntime::exit(int code) ALOGI("VM exiting with result code %d.", code); onExit(code); } + +#ifdef __ANDROID_CLANG_COVERAGE__ + // When compiled with coverage, a function is registered with atexit to call + // `__llvm_profile_write_file` when the process exit. + // For Clang code coverage to work, call exit instead of _exit to run hooks + // registered with atexit. + ::exit(code); +#else ::_exit(code); +#endif } void AndroidRuntime::onVmCreated(JNIEnv* env) |