summaryrefslogtreecommitdiff
path: root/perfetto_hprof
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2021-04-30 17:09:10 +0100
committer Roland Levillain <rpl@google.com> 2021-05-07 09:13:03 +0000
commita28c827fdb58ec489931d6e70e27818619bc1b75 (patch)
tree038448d3d8d2922c05296b60b1280c3ed3f596b6 /perfetto_hprof
parent7eedd447cb5a4904acf80123ef813a7b8dead9a2 (diff)
Use `quick_exit` instead of `_exit` (except for error handling).
Replace every occurrence of `_exit` (for cases other than pure error handling) with `quick_exit`, in order to allow functions registered with `at_quick_exit` to be called before exiting. In particular, this change will allow LLVM's code coverage profile dumping routine to be called before exiting ART processes. Test: mmma art Test: ART tests Bug: 186576313 Change-Id: Ia9b0dbb471e2a26600c8bd23f7567931d050fc9d
Diffstat (limited to 'perfetto_hprof')
-rw-r--r--perfetto_hprof/perfetto_hprof.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/perfetto_hprof/perfetto_hprof.cc b/perfetto_hprof/perfetto_hprof.cc
index a27fc5ccc7..c718cc06b0 100644
--- a/perfetto_hprof/perfetto_hprof.cc
+++ b/perfetto_hprof/perfetto_hprof.cc
@@ -23,6 +23,7 @@
#include <inttypes.h>
#include <sched.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -913,8 +914,10 @@ void DumpPerfetto(art::Thread* self) {
LOG(INFO) << "finished dumping heap for " << parent_pid;
// Prevent the atexit handlers to run. We do not want to call cleanup
- // functions the parent process has registered.
- _exit(0);
+ // functions the parent process has registered. However, have functions
+ // registered with `at_quick_exit` (for instance LLVM's code coverage profile
+ // dumping routine) be called before exiting.
+ quick_exit(0);
}
// The plugin initialization function.