10000 Cherrypick upstream reproducer changes. by JDevlieghere · Pull Request #10 · swiftlang/llvm-project · GitHub
[go: up one dir, main page]

Skip to content

Cherrypick upstream reproducer changes. #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Reproducer] Set the working directory in the VFS
Now that the VFS knows how to deal with virtual working directories, we
can set the current working directory to the one we recorded during
reproducer capture. This ensures that relative paths are resolved
correctly during replay.

llvm-svn: 375064
(cherry picked from commit f80f15e)
  • Loading branch information
JDevlieghere committed Oct 21, 2019
commit 8854daca1294f3242eaf1d1e4b4f79ababe98953
10 changes: 7 additions & 3 deletions lldb/lit/Reproducer/TestWorkingDir.test
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# This tests relative capture paths.
# This tests that the reproducer can deal with relative files. We create a
# binary in a subdirectory and pass its relative path to LLDB. The subdirectory
# is removed before replay so that it only exists in the reproducer's VFS.

# RUN: echo "CHECK: %t" > %t.check

# RUN: rm -rf %t.repro
# RUN: mkdir -p %t.repro
# RUN: mkdir -p %t
# RUN: mkdir -p %t/binary
# RUN: cd %t
# RUN: %clang %S/Inputs/simple.c -g -o %t/reproducer.out
# RUN: %lldb -x -b -s %S/Inputs/WorkingDir.in --capture --capture-path %t.repro %t/reproducer.out
# RUN: %clang %S/Inputs/simple.c -g -o binary/reproducer.out
# RUN: %lldb -x -b -s %S/Inputs/WorkingDir.in --capture --capture-path %t.repro binary/reproducer.out
# RUN: rm -rf %t/binary

# RUN: cat %t.repro/cwd.txt | FileCheck %t.check
# RUN: %lldb --replay %t.repro | FileCheck %t.check
7 changes: 7 additions & 0 deletions lldb/source/Initialization/SystemInitializerCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ llvm::Error SystemInitializerCommon::Initialize() {
} else {
FileSystem::Initialize();
}
if (llvm::Expected<std::string> cwd =
loader->LoadBuffer<WorkingDirectoryProvider>()) {
FileSystem::Instance().GetVirtualFileSystem()->setCurrentWorkingDirectory(
*cwd);
} else {
return cwd.takeError();
}
} else if (repro::Generator *g = r.GetGenerator()) {
repro::VersionProvider &vp = g->GetOrCreate<repro::VersionProvider>();
vp.SetVersion(lldb_private::GetVersion());
Expand Down
0