forked from OSchip/llvm-project
[llvm-dwp] Get the DWO file from relative path if the absolute path is not valid
Extend the llvm-dwp to support searching the DWOs that from relative path for the case that build from remote building system(different comp_dir). Reviewd By: dblaikie Differential Revision: https://reviews.llvm.org/D133480
This commit is contained in:
parent
79fa0ec8c4
commit
4531f53851
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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;
|
||||
}
|
|
@ -71,7 +71,10 @@ getDWOFilenames(StringRef ExecFilename) {
|
|||
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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue