• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: llvm-dsymutil -f -y %p/dummy-debug-map.map -oso-prepend-path %p/../Inputs/dead-stripped -o - | llvm-dwarfdump - -debug-dump=info | FileCheck %s
2 
3 // The test was compiled with:
4 // clang++ -O2 -g -c dead-strip.cpp -o 1.o
5 
6 // The goal of the test is to exercise dsymutil's behavior in presence of
7 // functions/variables that have been dead-stripped by the linker but
8 // that are still present in the linked debug info (in this case because
9 // they have been DW_TAG_import'd in another namespace).
10 
11 // Everything in the N namespace bellow doesn't have a debug map entry, and
12 // thus is considered dead (::foo() has a debug map entry, otherwse dsymutil
13 // would just drop the CU altogether).
14 
15 namespace N {
16 int blah = 42;
17 // This is actually a dsymutil-classic bug that we reproduced
18 // CHECK: DW_TAG_variable
19 // CHECK-NOT: DW_TAG
20 // CHECK: DW_AT_location
21 
foo()22 __attribute__((always_inline)) int foo() { return blah; }
23 // CHECK: DW_TAG_subprogram
24 // CHECK-NOT: DW_AT_low_pc
25 // CHECK-NOT: DW_AT_high_pc
26 // CHECK: DW_AT_frame_base
27 
28 // CHECK: DW_TAG_subprogram
29 
bar(unsigned i)30 int bar(unsigned i) {
31 	int val = foo();
32 	if (i)
33 		return val + bar(i-1);
34 	return foo();
35 }
36 // CHECK: DW_TAG_subprogram
37 // CHECK-NOT: DW_AT_low_pc
38 // CHECK-NOT: DW_AT_high_pc
39 // CHECK: DW_AT_frame_base
40 // CHECK-NOT: DW_AT_location
41 // CHECK-NOT: DW_AT_low_pc
42 // CHECK-NOT: DW_AT_high_pc
43 
44 }
45 // CHECK: TAG_imported_module
46 using namespace N;
47 
foo()48 void foo() {}
49