[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
Fri Sep 9 17:47:42 PDT 2022
steven.zhang updated this revision to Diff 459239.
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 "/tmp" -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.459239.patch
Type: text/x-patch
Size: 1376 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220910/8d7f00ad/attachment.bin>
More information about the llvm-commits
mailing list