summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-10-18 03:25:39 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-10-18 03:25:39 +0000
commite8f995746f85ec048bcc851fecd501bb643c4b96 (patch)
tree679c8534ad1c230e613d60b1eeba5df06ff920e9
parent2a82edb031d5b1c5b31afe9956cae038e491e54f (diff)
parent739b1548602703b2d168bd7ebc8573bd846f3862 (diff)
downloadextras-e8f995746f85ec048bcc851fecd501bb643c4b96.tar.gz
Merge "simpleperf: handle memfds created by memfd_create."
-rw-r--r--simpleperf/environment.cpp4
-rw-r--r--simpleperf/environment_test.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp
index eed4ee42..507859ec 100644
--- a/simpleperf/environment.cpp
+++ b/simpleperf/environment.cpp
@@ -840,10 +840,12 @@ bool MappedFileOnlyExistInMemory(const char* filename) {
// [stack]
// /dev/*
// //anon: generated by kernel/events/core.c.
+ // /memfd: created by memfd_create.
return filename[0] == '\0' ||
(filename[0] == '[' && strcmp(filename, "[vdso]") != 0) ||
strncmp(filename, "//", 2) == 0 ||
- strncmp(filename, "/dev/", 5) == 0;
+ strncmp(filename, "/dev/", 5) == 0 ||
+ strncmp(filename, "/memfd:", 7) == 0;
}
std::string GetCompleteProcessName(pid_t pid) {
diff --git a/simpleperf/environment_test.cpp b/simpleperf/environment_test.cpp
index 8e9f1c8f..045194c3 100644
--- a/simpleperf/environment_test.cpp
+++ b/simpleperf/environment_test.cpp
@@ -59,6 +59,7 @@ TEST(environment, MappedFileOnlyExistInMemory) {
ASSERT_FALSE(MappedFileOnlyExistInMemory("[vdso]"));
ASSERT_TRUE(MappedFileOnlyExistInMemory("/dev/__properties__/u:object_r"));
ASSERT_TRUE(MappedFileOnlyExistInMemory("//anon"));
+ ASSERT_TRUE(MappedFileOnlyExistInMemory("/memfd:/jit-cache"));
ASSERT_FALSE(MappedFileOnlyExistInMemory("./TemporaryFile-12345"));
ASSERT_FALSE(MappedFileOnlyExistInMemory("/system/lib64/libc.so"));
}