brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 00df724 Raw
48 lines · cpp
1// Checks that module map does not print at 0, prints once after aborting with 1,2// and prints once before and after aborting with 23 4// mac header is "Process module map"5// other posix header is "Process memory map follows"6// windows header is "Dumping process modules" (ignored here)7// we should consider unifying the message cross platform8 9// RUN: %clangxx -DUSING_%tool_name %s -o %t -w10 11// RUN: %env_tool_opts="print_module_map=0:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM012// RUN: %env_tool_opts="print_module_map=1:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM113// RUN: %env_tool_opts="print_module_map=2:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM214 15// tsan support pending rdar://6774747316// XFAIL: tsan17 18// FIXME: Add linux support.19// XFAIL: msan && target={{.*linux.*}}20 21// FIXME: Implement.22// XFAIL: lsan, hwasan23 24int global;25 26int main() {27#if defined(USING_ubsan)28  int value = 5;29  int computation = value / 0; // Division by zero.30#else31  volatile int *a = new int[100];32  delete[] a;33  global = a[0]; // use-after-free: triggers ASan/TSan report.34#endif35  return 0;36}37 38// CHECK-NOT: {{Process .*map}}39// CHECK: SUMMARY:40// CHECK-MM0-NOT: {{Process .*map}}41 42// CHECK-MM1: {{Process (module|memory) map}}43// CHECK-MM1-NOT: {{Process .*map}}44 45// CHECK-MM2: {{Process (module|memory) map}}46// CHECK-MM2: {{Process (module|memory) map}}47// CHECK-MM2-NOT: {{Process .*map}}48