Loading libbacktrace/backtrace_benchmarks.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -35,10 +35,6 @@ #include <backtrace/BacktraceMap.h> #include <unwindstack/Memory.h> // Definitions of prctl arguments to set a vma name in Android kernels. #define ANDROID_PR_SET_VMA 0x53564d41 #define ANDROID_PR_SET_VMA_ANON_NAME 0 constexpr size_t kNumMaps = 2000; static bool CountMaps(pid_t pid, size_t* num_maps) { Loading Loading @@ -93,10 +89,11 @@ static void CreateMap(benchmark::State& state, BacktraceMap* (*map_func)(pid_t, exit(1); } memset(memory, 0x1, PAGE_SIZE); if (prctl(ANDROID_PR_SET_VMA, ANDROID_PR_SET_VMA_ANON_NAME, memory, PAGE_SIZE, "test_map") == -1) { #if defined(PR_SET_VMA) if (prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, memory, PAGE_SIZE, "test_map") == -1) { fprintf(stderr, "Failed: %s\n", strerror(errno)); } #endif maps.push_back(memory); } Loading libmemunreachable/Allocator.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <sys/cdefs.h> #include <sys/mman.h> #include <sys/prctl.h> #include <cmath> #include <cstddef> Loading @@ -35,7 +36,6 @@ #include "Allocator.h" #include "LinkedList.h" #include "anon_vma_naming.h" namespace android { Loading Loading @@ -153,10 +153,10 @@ static void* MapAligned(size_t size, size_t align) { munmap(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) + size), map_size - size); } #define PR_SET_VMA 0x53564d41 #define PR_SET_VMA_ANON_NAME 0 #if defined(PR_SET_VMA) prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, reinterpret_cast<uintptr_t>(ptr), size, "leak_detector_malloc"); #endif return ptr; } Loading libmemunreachable/PtracerThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/prctl.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> Loading @@ -32,7 +33,6 @@ #include "android-base/macros.h" #include "PtracerThread.h" #include "anon_vma_naming.h" #include "log.h" namespace android { Loading libmemunreachable/anon_vma_naming.hdeleted 100644 → 0 +0 −25 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ #define LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ #include <sys/prctl.h> #define PR_SET_VMA 0x53564d41 #define PR_SET_VMA_ANON_NAME 0 #endif // LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ Loading
libbacktrace/backtrace_benchmarks.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -35,10 +35,6 @@ #include <backtrace/BacktraceMap.h> #include <unwindstack/Memory.h> // Definitions of prctl arguments to set a vma name in Android kernels. #define ANDROID_PR_SET_VMA 0x53564d41 #define ANDROID_PR_SET_VMA_ANON_NAME 0 constexpr size_t kNumMaps = 2000; static bool CountMaps(pid_t pid, size_t* num_maps) { Loading Loading @@ -93,10 +89,11 @@ static void CreateMap(benchmark::State& state, BacktraceMap* (*map_func)(pid_t, exit(1); } memset(memory, 0x1, PAGE_SIZE); if (prctl(ANDROID_PR_SET_VMA, ANDROID_PR_SET_VMA_ANON_NAME, memory, PAGE_SIZE, "test_map") == -1) { #if defined(PR_SET_VMA) if (prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, memory, PAGE_SIZE, "test_map") == -1) { fprintf(stderr, "Failed: %s\n", strerror(errno)); } #endif maps.push_back(memory); } Loading
libmemunreachable/Allocator.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <sys/cdefs.h> #include <sys/mman.h> #include <sys/prctl.h> #include <cmath> #include <cstddef> Loading @@ -35,7 +36,6 @@ #include "Allocator.h" #include "LinkedList.h" #include "anon_vma_naming.h" namespace android { Loading Loading @@ -153,10 +153,10 @@ static void* MapAligned(size_t size, size_t align) { munmap(reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(ptr) + size), map_size - size); } #define PR_SET_VMA 0x53564d41 #define PR_SET_VMA_ANON_NAME 0 #if defined(PR_SET_VMA) prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, reinterpret_cast<uintptr_t>(ptr), size, "leak_detector_malloc"); #endif return ptr; } Loading
libmemunreachable/PtracerThread.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <sys/prctl.h> #include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> Loading @@ -32,7 +33,6 @@ #include "android-base/macros.h" #include "PtracerThread.h" #include "anon_vma_naming.h" #include "log.h" namespace android { Loading
libmemunreachable/anon_vma_naming.hdeleted 100644 → 0 +0 −25 Original line number Diff line number Diff line /* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ #define LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_ #include <sys/prctl.h> #define PR_SET_VMA 0x53564d41 #define PR_SET_VMA_ANON_NAME 0 #endif // LIBMEMUNREACHABLE_ANON_VMA_NAMING_H_