[llvm] r371909 - [Reproducer] Add reproducer dump command.
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 16:27:32 PDT 2019
Author: jdevlieghere
Date: Fri Sep 13 16:27:31 2019
New Revision: 371909
URL: http://llvm.org/viewvc/llvm-project?rev=371909&view=rev
Log:
[Reproducer] Add reproducer dump command.
This adds a reproducer dump commands which makes it possible to inspect
a reproducer from inside LLDB. Currently it supports the Files, Commands
and Version providers. I'm planning to add support for the GDB Remote
provider in a follow-up patch.
Differential revision: https://reviews.llvm.org/D67474
Modified:
llvm/trunk/include/llvm/Support/VirtualFileSystem.h
llvm/trunk/lib/Support/VirtualFileSystem.cpp
Modified: llvm/trunk/include/llvm/Support/VirtualFileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/VirtualFileSystem.h?rev=371909&r1=371908&r2=371909&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/VirtualFileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/VirtualFileSystem.h Fri Sep 13 16:27:31 2019
@@ -730,9 +730,10 @@ public:
StringRef getExternalContentsPrefixDir() const;
+ void dump(raw_ostream &OS) const;
+ void dumpEntry(raw_ostream &OS, Entry *E, int NumSpaces = 0) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const;
- LLVM_DUMP_METHOD void dumpEntry(Entry *E, int NumSpaces = 0) const;
#endif
};
Modified: llvm/trunk/lib/Support/VirtualFileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/VirtualFileSystem.cpp?rev=371909&r1=371908&r2=371909&view=diff
==============================================================================
--- llvm/trunk/lib/Support/VirtualFileSystem.cpp (original)
+++ llvm/trunk/lib/Support/VirtualFileSystem.cpp Fri Sep 13 16:27:31 2019
@@ -1082,20 +1082,19 @@ StringRef RedirectingFileSystem::getExte
return ExternalContentsPrefixDir;
}
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void RedirectingFileSystem::dump() const {
+void RedirectingFileSystem::dump(raw_ostream &OS) const {
for (const auto &Root : Roots)
- dumpEntry(Root.get());
+ dumpEntry(OS, Root.get());
}
-LLVM_DUMP_METHOD void
-RedirectingFileSystem::dumpEntry(RedirectingFileSystem::Entry *E,
- int NumSpaces) const {
+void RedirectingFileSystem::dumpEntry(raw_ostream &OS,
+ RedirectingFileSystem::Entry *E,
+ int NumSpaces) const {
StringRef Name = E->getName();
for (int i = 0, e = NumSpaces; i < e; ++i)
- dbgs() << " ";
- dbgs() << "'" << Name.str().c_str() << "'"
- << "\n";
+ OS << " ";
+ OS << "'" << Name.str().c_str() << "'"
+ << "\n";
if (E->getKind() == RedirectingFileSystem::EK_Directory) {
auto *DE = dyn_cast<RedirectingFileSystem::RedirectingDirectoryEntry>(E);
@@ -1103,9 +1102,12 @@ RedirectingFileSystem::dumpEntry(Redirec
for (std::unique_ptr<Entry> &SubEntry :
llvm::make_range(DE->contents_begin(), DE->contents_end()))
- dumpEntry(SubEntry.get(), NumSpaces + 2);
+ dumpEntry(OS, SubEntry.get(), NumSpaces + 2);
}
}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+LLVM_DUMP_METHOD void RedirectingFileSystem::dump() const { dump(dbgs()); }
#endif
/// A helper class to hold the common YAML parsing state.
More information about the llvm-commits
mailing list