[PATCH] D133480: [llvm-dwp] Get the DWO file from relative path if the absolute path is not valid
Qing Shan Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 22:46:28 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4531f5385125: [llvm-dwp] Get the DWO file from relative path if the absolute path is not valid (authored by steven.zhang).
Changed prior to commit:
https://reviews.llvm.org/D133480?vs=459239&id=459648#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133480/new/
https://reviews.llvm.org/D133480
Files:
llvm/test/tools/llvm-dwp/Inputs/search_dwos/a.dwo
llvm/test/tools/llvm-dwp/Inputs/search_dwos/b.dwo
llvm/test/tools/llvm-dwp/Inputs/search_dwos/main
llvm/test/tools/llvm-dwp/X86/search_dwos.test
llvm/tools/llvm-dwp/llvm-dwp.cpp
Index: llvm/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -71,7 +71,10 @@
if (!DWOCompDir.empty()) {
SmallString<16> DWOPath(std::move(DWOName));
sys::fs::make_absolute(DWOCompDir, DWOPath);
- DWOPaths.emplace_back(DWOPath.data(), DWOPath.size());
+ if (!sys::fs::exists(DWOPath) && sys::fs::exists(DWOName))
+ DWOPaths.push_back(std::move(DWOName));
+ else
+ DWOPaths.emplace_back(DWOPath.data(), DWOPath.size());
} else {
DWOPaths.push_back(std::move(DWOName));
}
Index: llvm/test/tools/llvm-dwp/X86/search_dwos.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwp/X86/search_dwos.test
@@ -0,0 +1,22 @@
+RUN: rm -rf %t
+RUN: mkdir %t
+RUN: cd %t
+RUN: cp %p/../Inputs/search_dwos/a.dwo a.dwo
+RUN: cp %p/../Inputs/search_dwos/b.dwo b.dwo
+RUN: cp %p/../Inputs/search_dwos/main main
+RUN: llvm-dwp -e main -o %t.dwp
+
+Search the DWO from relative path if absolute path is not valid.
+Build commands for the test binaries:
+
+clang++ -Xclang -fdebug-compilation-dir -Xclang "path-not-exists" -g -O0 -gsplit-dwarf a.cpp b.cpp -o main
+
+sources:
+a.cpp:
+ void a() {}
+
+b.cpp:
+ void b() {}
+ int main() {
+ return 0;
+ }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133480.459648.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220913/59515951/attachment.bin>
More information about the llvm-commits
mailing list