55 lines · cpp
1// RUN: dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/dead-stripped -o - | llvm-dwarfdump - --debug-info | FileCheck %s --implicit-check-not "{{DW_AT_low_pc|DW_AT_high_pc|DW_AT_location|DW_TAG|NULL}}"2 3// The test was compiled with:4// clang++ -O2 -g -c dead-strip.cpp -o 1.o5 6// The goal of the test is to exercise dsymutil's behavior in presence of7// functions/variables that have been dead-stripped by the linker but8// that are still present in the linked debug info (in this case because9// they have been DW_TAG_import'd in another namespace).10 11// Everything in the N namespace below doesn't have a debug map entry, and12// thus is considered dead (::foo() has a debug map entry, otherwise dsymutil13// would just drop the CU altogether).14 15// CHECK: DW_TAG_compile_unit16// CHECK: DW_AT_low_pc17// CHECK: DW_AT_high_pc18// CHECK: DW_TAG_namespace19namespace N {20int blah = 42;21// CHECK: DW_TAG_variable22// CHECK-NOT: DW_AT_location23 24__attribute__((always_inline)) int foo() { return blah; }25// CHECK: DW_TAG_subprogram26// CHECK-NOT: DW_AT_frame_base27 28// CHECK: DW_TAG_subprogram29 30int bar(unsigned i) {31 int val = foo();32 if (i)33 return val + bar(i-1);34 return foo();35}36// CHECK: DW_TAG_subprogram37// CHECK-NOT: DW_AT_frame_base38// CHECK: DW_TAG_formal_parameter39// CHECK: DW_TAG_variable40// CHECK: DW_TAG_inlined_subroutine41// CHECK: NULL42// CHECK: NULL43}44// CHECK: DW_TAG_base_type45// CHECK: DW_TAG_imported_module46// CHECK: DW_TAG_subprogram47// CHECK: DW_AT_low_pc48// CHECK: DW_AT_high_pc49// CHECK: DW_TAG_base_type50// CHECK: NULL51 52using namespace N;53 54void foo() {}55