[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / tools / dsymutil / X86 / inlined-static-variable.cpp
blob5593b2638147e462c3468684226b1787109c510f
1 // RUN: dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/inlined-static-variable -o - | llvm-dwarfdump - | FileCheck %s --implicit-check-not "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}"
3 // clang -g -c inlined-static-variable.cpp -o 4.o
5 // The functions removed and not_removed are not in the debug map and are
6 // considered dead, but they are also inlined into the function foo which is
7 // in the debug map. Those function-local globals are alive and thus should
8 // have locations in the debug info even if their functions do not.
10 inline __attribute__((always_inline)) int removed() {
11 static int a = 0;
12 return ++a;
15 __attribute__((always_inline)) int not_removed() {
16 static int b = 0;
17 return ++b;
20 int unused() {
21 static int c = 0;
22 return ++c;
25 int foo() {
26 return removed() + not_removed();
29 // CHECK: DW_TAG_compile_unit
30 // CHECK: DW_AT_low_pc
31 // CHECK: DW_AT_high_pc
33 // CHECK: DW_TAG_subprogram
34 // CHECK: DW_AT_name ("removed")
35 // CHECK: DW_TAG_variable
36 // CHECK: DW_AT_name ("a")
37 // CHECK: DW_AT_location
38 // CHECK: NULL
40 // CHECK: DW_TAG_base_type
41 // CHECK: DW_TAG_subprogram
42 // CHECK: DW_AT_name ("not_removed")
43 // CHECK: DW_TAG_variable
44 // CHECK: DW_AT_name ("b")
45 // CHECK: DW_AT_location
46 // CHECK: NULL
48 // CHECK: DW_TAG_subprogram
49 // CHECK: DW_AT_low_pc
50 // CHECK: DW_AT_high_pc
51 // CHECK: DW_AT_name ("foo")
52 // CHECK: DW_TAG_inlined_subroutine
53 // CHECK: DW_AT_low_pc
54 // CHECK: DW_AT_high_pc
55 // CHECK: DW_TAG_inlined_subroutine
56 // CHECK: DW_AT_low_pc
57 // CHECK: DW_AT_high_pc
58 // CHECK: NULL
59 // CHECK: NULL