// First, find a subprogram that contains the given address (the root
// of inlined chain).
const DWARFUnit *ChainCU = nullptr;
- const DWARFDebugInfoEntryMinimal *SubprogramDIE =
- getSubprogramForAddress(Address);
- if (SubprogramDIE) {
+ const DWARFDebugInfoEntryMinimal *SubprogramDIE;
+ // Try to look for subprogram DIEs in the DWO file.
+ parseDWO();
+ if (DWO) {
+ if ((SubprogramDIE = DWO->getUnit()->getSubprogramForAddress(Address)))
+ ChainCU = DWO->getUnit();
+ } else if ((SubprogramDIE = getSubprogramForAddress(Address)))
ChainCU = this;
- } else {
- // Try to look for subprogram DIEs in the DWO file.
- parseDWO();
- if (DWO.get()) {
- SubprogramDIE = DWO->getUnit()->getSubprogramForAddress(Address);
- if (SubprogramDIE)
- ChainCU = DWO->getUnit();
- }
- }
// Get inlined chain rooted at this subprogram DIE.
if (!SubprogramDIE)
-int foo(int a) {
- return a + 1;
+void f1() {
}
-int main(int argc, char *argv[]) {
- return foo(argc);
+inline __attribute__((always_inline)) void f2() {
+ f1();
+}
+
+int main() {
+ f2();
}
// Build instructions:
-// 1) clang++ -### -O2 -gsplit-dwarf.cc split-dwarf-test.cc -o split-dwarf-test
+// 1) clang++ -### -gsplit-dwarf split-dwarf-test.cc -o split-dwarf-test
// 2) Replace the value "-fdebug-compilation-dir" flag to "Output"
// (this is the temp directory used by lit).
// 3) Manually run clang-cc1, objcopy and ld invocations.
RUN: echo "%p/Inputs/fission-ranges.elf-x86_64 0x720" >> %t.input
RUN: echo "%p/Inputs/arange-overlap.elf-x86_64 0x714" >> %t.input
RUN: cp %p/Inputs/split-dwarf-test.dwo %T
-RUN: echo "%p/Inputs/split-dwarf-test 0x4004d0" >> %t.input
-RUN: echo "%p/Inputs/split-dwarf-test 0x4004c0" >> %t.input
+RUN: echo "%p/Inputs/split-dwarf-test 0x4005d4" >> %t.input
+RUN: echo "%p/Inputs/split-dwarf-test 0x4005c4" >> %t.input
RUN: echo "%p/Inputs/cross-cu-inlining.x86_64-macho.o 0x17" >> %t.input
RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
-RUN: --default-arch=i386 < %t.input | FileCheck %s
+RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=CHECK --check-prefix=SPLIT --check-prefix=DWO %s
+
+Ensure we get the same results in the absence of gmlt-like data in the executable but the presence of a .dwo file
+
+RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x4005d4" >> %t.input
+RUN: echo "%p/Inputs/split-dwarf-test-nogmlt 0x4005c4" >> %t.input
+RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
+RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=DWO %s
+
+Ensure we get gmlt like results in the absence of a .dwo file but the presence of gmlt-like data in the executable
+
+RUN: rm %T/split-dwarf-test.dwo
+RUN: echo "%p/Inputs/split-dwarf-test 0x4005d4" >> %t.input
+RUN: echo "%p/Inputs/split-dwarf-test 0x4005c4" >> %t.input
+RUN: llvm-symbolizer --functions=linkage --inlining --demangle=false \
+RUN: --default-arch=i386 < %t.input | FileCheck --check-prefix=SPLIT --check-prefix=NODWO %s
CHECK: main
CHECK-NEXT: /tmp/dbginfo{{[/\\]}}dwarfdump-test.cc:16
CHECK: _ZN1S3bazEv
CHECK-NEXT: {{.*}}arange-overlap.cc:6
-CHECK: _Z3fooi
-CHECK-NEXT: {{.*}}split-dwarf-test.cc
-CHECK-NEXT: main
-CHECK-NEXT: {{.*}}split-dwarf-test.cc
+DWO: _Z2f2v
+NODWO: {{^f2$}}
+SPLIT-NEXT: {{.*}}split-dwarf-test.cc
+SPLIT-NEXT: main
+SPLIT-NEXT: {{.*}}split-dwarf-test.cc
-CHECK: _Z3fooi
-CHECK-NEXT: {{.*}}split-dwarf-test.cc
+SPLIT: _Z2f1v
+SPLIT-NEXT: {{.*}}split-dwarf-test.cc
; func has been inlined into main by LTO. Check that the symbolizer is able
; to resolve the cross-cu reference and retrieve func's name