summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/hwasan
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2019-01-25 02:05:25 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2019-01-25 02:05:25 +0000
commit9ea001401caa607dccbd974df0d44b13be63de20 (patch)
treee6918da0038ebaf945e52bfc7bfe56e23b088743 /compiler-rt/test/hwasan
parent6fdd2bd503c908eddfc2237fe8a5293ab54047ea (diff)
downloadbcm5719-llvm-9ea001401caa607dccbd974df0d44b13be63de20.tar.gz
bcm5719-llvm-9ea001401caa607dccbd974df0d44b13be63de20.zip
[hwasan] Implement print_module_map flag.
Reviewers: kcc, pcc Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D57130 llvm-svn: 352150
Diffstat (limited to 'compiler-rt/test/hwasan')
-rw-r--r--compiler-rt/test/hwasan/TestCases/print-module-map.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/print-module-map.c b/compiler-rt/test/hwasan/TestCases/print-module-map.c
new file mode 100644
index 00000000000..bb94aa11666
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/print-module-map.c
@@ -0,0 +1,32 @@
+// RUN: %clang_hwasan %s -o %t && %env_hwasan_opts=print_module_map=1 %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE
+// RUN: %clang_hwasan %s -DBUG -o %t && %env_hwasan_opts=print_module_map=1 not %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE
+// RUN: %clang_hwasan %s -DBUG -fsanitize-recover=hwaddress -o %t && %env_hwasan_opts=print_module_map=1,halt_on_error=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=EXIT,NOMORE
+// RUN: %clang_hwasan %s -DBUG -fsanitize-recover=hwaddress -o %t && %env_hwasan_opts=print_module_map=2,halt_on_error=0 not %run %t 2>&1 | FileCheck %s --check-prefixes=BUG1,BUG2,EXIT,NOMORE
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sanitizer/hwasan_interface.h>
+
+int main() {
+ __hwasan_enable_allocator_tagging();
+#ifdef BUG
+ char * volatile x = (char*)malloc(40);
+ free(x);
+ free(x);
+ free(x);
+#endif
+ __hwasan_disable_allocator_tagging();
+ // BUG1: Process memory map follows:
+ // BUG1: print-module-map
+ // BUG1: End of process memory map.
+
+ // BUG2: Process memory map follows:
+ // BUG2: print-module-map
+ // BUG2: End of process memory map.
+
+ // EXIT: Process memory map follows:
+ // EXIT: print-module-map
+ // EXIT: End of process memory map.
+
+ // NOMORE-NOT: Process memory map follows:
+}
OpenPOWER on IntegriCloud