[Lldb-commits] [lldb] f8df2e1 - [lldb/Reproducers] Always record the current working directory

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jul 21 05:06:33 PDT 2020


On 20/07/2020 20:54, Jonas Devlieghere via lldb-commits wrote:
> 
> Author: Jonas Devlieghere
> Date: 2020-07-20T11:54:11-07:00
> New Revision: f8df2e1a19913e997d8d6dbe573de977406e736e
> 
> URL: https://github.com/llvm/llvm-project/commit/f8df2e1a19913e997d8d6dbe573de977406e736e
> DIFF: https://github.com/llvm/llvm-project/commit/f8df2e1a19913e997d8d6dbe573de977406e736e.diff
> 
> LOG: [lldb/Reproducers] Always record the current working directory
> 
> Setting the current working directory in the VFS will fail if the given
> path doesn't exist in the YAML mapping or on disk.
> 
> Added: 
>     
> 
> Modified: 
>     lldb/include/lldb/Utility/Reproducer.h
>     lldb/source/API/SBReproducer.cpp
>     lldb/source/Initialization/SystemInitializerCommon.cpp
>     lldb/test/Shell/Reproducer/TestWorkingDir.test
> 
> Removed: 
>     
> 
> 
> ################################################################################
> diff  --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h
> index 2714db8d2932..6fcb839684dc 100644
> --- a/lldb/include/lldb/Utility/Reproducer.h
> +++ b/lldb/include/lldb/Utility/Reproducer.h
> @@ -11,6 +11,7 @@
>  
>  #include "lldb/Utility/FileSpec.h"
>  #include "llvm/ADT/DenseMap.h"
> +#include "llvm/ADT/StringRef.h"
>  #include "llvm/Support/Error.h"
>  #include "llvm/Support/FileCollector.h"
>  #include "llvm/Support/YAMLTraits.h"
> @@ -149,6 +150,7 @@ class WorkingDirectoryProvider : public Provider<WorkingDirectoryProvider> {
>    }
>  
>    void Update(llvm::StringRef path) { m_cwd = std::string(path); }
> +  llvm::StringRef GetWorkingDirectory() { return m_cwd; }
>  
>    struct Info {
>      static const char *name;
> 
> diff  --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp
> index 0eb3429c4fef..9815bf11263c 100644
> --- a/lldb/source/API/SBReproducer.cpp
> +++ b/lldb/source/API/SBReproducer.cpp
> @@ -234,7 +234,10 @@ const char *SBReproducer::GetPath() {
>  
>  void SBReproducer::SetWorkingDirectory(const char *path) {
>    if (auto *g = lldb_private::repro::Reproducer::Instance().GetGenerator()) {
> -    g->GetOrCreate<WorkingDirectoryProvider>().Update(path);
> +    auto &wp = g->GetOrCreate<repro::WorkingDirectoryProvider>();
> +    wp.Update(path);
> +    auto &fp = g->GetOrCreate<repro::FileProvider>();
> +    fp.RecordInterestingDirectory(wp.GetWorkingDirectory());


If I'm not mistaken, this will (recursively) record the entire contents
of the CWD. That could be a _lot_. Are you that's what you wanted?

pl


More information about the lldb-commits mailing list