summaryrefslogtreecommitdiff
path: root/test/scudo
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2018-04-25 18:52:29 +0000
committerKostya Kortchinsky <kostyak@google.com>2018-04-25 18:52:29 +0000
commitbc4072ffad7ecb03530b4bdf2da27fd49d29e607 (patch)
tree0061f6ff3b381134a4342259bea065fdcf442c65 /test/scudo
parent77cb99480a98ca2b2c30de28dc736d5b13ae67d6 (diff)
[scudo] Adding an interface function to print allocator stats
Summary: This adds `__scudo_print_stats` as an interface function to display the Primary and Secondary allocator statistics for Scudo. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D46016 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/scudo')
-rw-r--r--test/scudo/stats.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/scudo/stats.c b/test/scudo/stats.c
new file mode 100644
index 000000000..e7cc78ff0
--- /dev/null
+++ b/test/scudo/stats.c
@@ -0,0 +1,21 @@
+// RUN: %clang_scudo %s -o %t
+// RUN: %run %t 2>&1 | FileCheck %s
+
+// Tests that the allocator stats printing function exists and outputs
+// "something". Currently that "something" is fairly nebulous, as the 32-bit
+// primary doesn't output anything, and for the 64-bit one it's highly dependent
+// on the size class map and potential library allocations. So keep it very
+// generic for now.
+
+#include <stdlib.h>
+
+#include <sanitizer/scudo_interface.h>
+
+int main(int argc, char **argv)
+{
+ free(malloc(1U));
+ __scudo_print_stats();
+ return 0;
+}
+
+// CHECK: Stats: