Skip to content

Commit 8519343

Browse files
committed
add test
1 parent a21d0a8 commit 8519343

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,8 +1638,12 @@ void BinaryContext::preprocessDWODebugInfo() {
16381638
sys::path::append(AbsolutePath, opts::CompDirOverride);
16391639
sys::path::append(AbsolutePath, DWOName);
16401640
} else if (!sys::fs::exists(DwarfUnit->getCompilationDir()) &&
1641-
sys::fs::exists(DWOName))
1641+
sys::fs::exists(DWOName)) {
1642+
this->outs()
1643+
<< "BOLT-WARNING: Debug Fission: Debug Compilation Dir wrong for "
1644+
<< DWOName << ". DWO Name will be directly used for retrieving.\n";
16421645
AbsolutePath = DWOName;
1646+
}
16431647
DWARFUnit *DWOCU =
16441648
DwarfUnit->getNonSkeletonUnitDIE(false, AbsolutePath).getDwarfUnit();
16451649
if (!DWOCU->isDWOUnit()) {

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,8 @@ void DWARFRewriter::writeDWOFiles(
18511851
CompDir = opts::DwarfOutputPath.c_str();
18521852
else if (!opts::CompDirOverride.empty())
18531853
CompDir = opts::CompDirOverride;
1854-
else if (!sys::fs::exists(CompDir))
1855-
CompDir = ".";
1854+
else if (!sys::fs::exists(CompDir) && sys::fs::exists(DWOName))
1855+
CompDir = "";
18561856

18571857
SmallString<16> AbsolutePath;
18581858
sys::path::append(AbsolutePath, CompDir);

bolt/test/dwo-name-retrieving.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test checks retrieving dwo file diercetly with dwo name,
2+
// if the Debug Compilation Dir does not exist.
3+
4+
int main() { return 0; }
5+
6+
// RUN: rm -rf %t && mkdir -p %t && cd %t
7+
// RUN: %clang %cflags -g -gsplit-dwarf -fdebug-compilation-dir=/path/does/not/exist %s -o main.exe
8+
// RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections 2>&1 | FileCheck %s -check-prefix=NOT-EXIST
9+
10+
// NOT-EXIST: BOLT-WARNING: Debug Fission: Debug Compilation Dir wrong for
11+
12+
// RUN: rm -rf %t && mkdir -p %t && cd %t
13+
// RUN: %clang %cflags -g -gsplit-dwarf -fdebug-compilation-dir=/path/does/not/exist %s -o %t/main.exe
14+
// RUN: llvm-bolt %t/main.exe -o %t/main.exe.bolt -update-debug-sections 2>&1 | FileCheck %s -check-prefix=FOUND
15+
16+
// FOUND-NOT: Debug Fission: DWO debug information for

0 commit comments

Comments
 (0)