| 1 |
// RUN: dsymutil --linker parallel --no-odr -f -y %p/../dummy-debug-map.map -oso-prepend-path \ |
| 2 |
// RUN: %p/../../Inputs/dead-stripped -o - | llvm-dwarfdump - --debug-info | \ |
| 3 |
// RUN: FileCheck %s --implicit-check-not \ |
| 4 |
// RUN: "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" |
| 5 |
// |
| 6 |
// RUN: dsymutil --linker parallel -f -y %p/../dummy-debug-map.map -oso-prepend-path \ |
| 7 |
// RUN: %p/../../Inputs/dead-stripped -o - | llvm-dwarfdump - --debug-info | \ |
| 8 |
// RUN: FileCheck %s --implicit-check-not \ |
| 9 |
// RUN: "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}" \ |
| 10 |
// RUN: --check-prefixes=CHECK-LLVM |
| 11 |
|
| 12 |
// The test was compiled with: |
| 13 |
// clang++ -O2 -g -c dead-strip.cpp -o 1.o |
| 14 |
|
| 15 |
// The goal of the test is to exercise dsymutil's behavior in presence of |
| 16 |
// functions/variables that have been dead-stripped by the linker but |
| 17 |
// that are still present in the linked debug info (in this case because |
| 18 |
// they have been DW_TAG_import'd in another namespace). |
| 19 |
|
| 20 |
// CHECK-LLVM: DW_TAG_compile_unit |
| 21 |
// CHECK-LLVM: DW_AT_name{{.*}}"__artificial_type_unit" |
| 22 |
// CHECK-LLVM: DW_TAG_namespace |
| 23 |
// CHECK-LLVM: DW_AT_name{{.*}}"N" |
| 24 |
// CHECK-LLVM: NULL |
| 25 |
// |
| 26 |
// CHECK-LLVM: DW_TAG_compile_unit |
| 27 |
// CHECK-LLVM: DW_AT_low_pc |
| 28 |
// CHECK-LLVM: DW_AT_high_pc |
| 29 |
// CHECK-LLVM: DW_TAG_base_type |
| 30 |
// CHECK-LLVM: DW_TAG_imported_module |
| 31 |
// CHECK-LLVM: DW_TAG_subprogram |
| 32 |
// CHECK-LLVM: DW_AT_low_pc |
| 33 |
// CHECK-LLVM: DW_AT_high_pc |
| 34 |
// CHECK-LLVM: DW_TAG_base_type |
| 35 |
// CHECK-LLVM: NULL |
| 36 |
|
| 37 |
// Everything in the N namespace below doesn't have a debug map entry, and |
| 38 |
// thus is considered dead (::foo() has a debug map entry, otherwise dsymutil |
| 39 |
// would just drop the CU altogether). |
| 40 |
|
| 41 |
// CHECK: DW_TAG_compile_unit |
| 42 |
// CHECK: DW_AT_low_pc |
| 43 |
// CHECK: DW_AT_high_pc |
| 44 |
// CHECK: DW_TAG_namespace |
| 45 |
namespace N { |
| 46 |
int blah = 42; |
| 47 |
|
| 48 |
__attribute__((always_inline)) int foo() { return blah; } |
| 49 |
|
| 50 |
int bar(unsigned i) { |
| 51 |
int val = foo(); |
| 52 |
if (i) |
| 53 |
return val + bar(i-1); |
| 54 |
return foo(); |
| 55 |
} |
| 56 |
} |
| 57 |
// CHECK: DW_TAG_base_type |
| 58 |
// CHECK: DW_TAG_imported_module |
| 59 |
// CHECK: DW_TAG_subprogram |
| 60 |
// CHECK: DW_AT_low_pc |
| 61 |
// CHECK: DW_AT_high_pc |
| 62 |
// CHECK: DW_TAG_base_type |
| 63 |
// CHECK: NULL |
| 64 |
|
| 65 |
using namespace N; |
| 66 |
|
| 67 |
void foo() {} |