diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-09-27 17:30:40 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-09-27 17:30:40 +0000 |
commit | cdec597905cd19324f6702af03c9ec4f3bf910da (patch) | |
tree | 417a8257ca6a3ef12672df5fd9b479c60c3495d1 /lldb/source/Utility | |
parent | 72c57ec3e6b320c31274dadb888dc16772b8e7b6 (diff) | |
download | bcm5719-llvm-cdec597905cd19324f6702af03c9ec4f3bf910da.tar.gz bcm5719-llvm-cdec597905cd19324f6702af03c9ec4f3bf910da.zip |
[Reproducer] Always use absolute paths for capture & replay.
The VFS requires files to be have absolute paths. The file collector
makes paths relative to the reproducer root. If the root is a relative
path, this would trigger an assert in the VFS. This patch ensures that
we always make the given path absolute.
Thank you Ted Woodward for pointing this out!
llvm-svn: 373102
Diffstat (limited to 'lldb/source/Utility')
-rw-r--r-- | lldb/source/Utility/Reproducer.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp index 8e44f080177..a8a581f0761 100644 --- a/lldb/source/Utility/Reproducer.cpp +++ b/lldb/source/Utility/Reproducer.cpp @@ -136,7 +136,15 @@ FileSpec Reproducer::GetReproducerPath() const { return {}; } -Generator::Generator(const FileSpec &root) : m_root(root), m_done(false) {} +static FileSpec MakeAbsolute(FileSpec file_spec) { + SmallString<128> path; + file_spec.GetPath(path, false); + llvm::sys::fs::make_absolute(path); + return FileSpec(path, file_spec.GetPathStyle()); +} + +Generator::Generator(FileSpec root) + : m_root(MakeAbsolute(std::move(root))), m_done(false) {} Generator::~Generator() {} @@ -188,7 +196,8 @@ void Generator::AddProvidersToIndex() { yout << files; } -Loader::Loader(const FileSpec &root) : m_root(root), m_loaded(false) {} +Loader::Loader(FileSpec root) + : m_root(MakeAbsolute(std::move(root))), m_loaded(false) {} llvm::Error Loader::LoadIndex() { if (m_loaded) |