1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[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

llvm-svn: 371909
This commit is contained in:
Jonas Devlieghere 2019-09-13 23:27:31 +00:00
parent c360a1f5f8
commit 028c66f478
2 changed files with 14 additions and 11 deletions

View File

@ -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
};

View File

@ -1082,19 +1082,18 @@ StringRef RedirectingFileSystem::getExternalContentsPrefixDir() const {
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,
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() << "'"
OS << " ";
OS << "'" << Name.str().c_str() << "'"
<< "\n";
if (E->getKind() == RedirectingFileSystem::EK_Directory) {
@ -1103,9 +1102,12 @@ RedirectingFileSystem::dumpEntry(RedirectingFileSystem::Entry *E,
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.