File: print-module-map.cpp

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (47 lines) | stat: -rw-r--r-- 1,501 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Checks that module map does not print at 0, prints once after aborting with 1,
// and prints once before and after aborting with 2

// mac header is "Process module map"
// other posix header is "Process memory map follows"
// windows header is "Dumping process modules" (ignored here)
// we should consider unifying the message cross platform

// RUN: %clangxx -DUSING_%tool_name %s -o %t -w

// RUN: %env_tool_opts="print_module_map=0:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM0
// RUN: %env_tool_opts="print_module_map=1:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM1
// RUN: %env_tool_opts="print_module_map=2:halt_on_error=1" not %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-MM2

// tsan support pending rdar://67747473
// XFAIL: tsan

// FIXME: Add linux support.
// XFAIL: msan && target={{.*linux.*}}

// FIXME: Implement.
// XFAIL: lsan, hwasan

int global;

int main() {
#if defined(USING_ubsan)
  int value = 5;
  int computation = value / 0; // Division by zero.
#else
  volatile int *a = new int[100];
  delete[] a;
  global = a[0]; // use-after-free: triggers ASan/TSan report.
#endif
  return 0;
}

// CHECK-NOT: {{Process .*map}}
// CHECK: SUMMARY:
// CHECK-MM0-NOT: {{Process .*map}}

// CHECK-MM1: {{Process (module|memory) map}}
// CHECK-MM1-NOT: {{Process .*map}}

// CHECK-MM2: {{Process (module|memory) map}}
// CHECK-MM2: {{Process (module|memory) map}}
// CHECK-MM2-NOT: {{Process .*map}}