summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-readobj
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-19 05:57:45 +0000
committerZachary Turner <zturner@google.com>2017-05-19 05:57:45 +0000
commit1dfcf8d92c808bd9fcb4d1a0d81582453f80c423 (patch)
tree611a9e1848ebefa1e5a9e22f6939c0482b8ee05e /llvm/tools/llvm-readobj
parent47fdc73771c39a83d97b8eb142dd311eb773e541 (diff)
downloadbcm5719-llvm-1dfcf8d92c808bd9fcb4d1a0d81582453f80c423.tar.gz
bcm5719-llvm-1dfcf8d92c808bd9fcb4d1a0d81582453f80c423.zip
Revert "[CodeView] Provide a common interface for type collections."
This is a squash of ~5 reverts of, well, pretty much everything I did today. Something is seriously broken with lit on Windows right now, and as a result assertions that fire in tests are triggering failures. I've been breaking non-Windows bots all day which has seriously confused me because all my tests have been passing, and after running lit with -a to view the output even on successful runs, I find out that the tool is crashing and yet lit is still reporting it as a success! At this point I don't even know where to start, so rather than leave the tree broken for who knows how long, I will get this back to green, and then once lit is fixed on Windows, hopefully hopefully fix the remaining set of problems for real. llvm-svn: 303409
Diffstat (limited to 'llvm/tools/llvm-readobj')
-rw-r--r--llvm/tools/llvm-readobj/COFFDumper.cpp58
1 files changed, 35 insertions, 23 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 78bfa558e4a..8e71c85fa8f 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -22,9 +22,8 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
-#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
+#include "llvm/DebugInfo/CodeView/CVTypeDumper.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h"
#include "llvm/DebugInfo/CodeView/ModuleDebugInlineeLinesFragment.h"
@@ -35,13 +34,11 @@
#include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
#include "llvm/DebugInfo/CodeView/SymbolDumper.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/DebugInfo/CodeView/TypeDatabase.h"
#include "llvm/DebugInfo/CodeView/TypeDumpVisitor.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
#include "llvm/DebugInfo/CodeView/TypeTableBuilder.h"
-#include "llvm/DebugInfo/CodeView/TypeTableCollection.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/BinaryStreamReader.h"
@@ -73,7 +70,7 @@ class COFFDumper : public ObjDumper {
public:
friend class COFFObjectDumpDelegate;
COFFDumper(const llvm::object::COFFObjectFile *Obj, ScopedPrinter &Writer)
- : ObjDumper(Writer), Obj(Obj), Writer(Writer), Types(100) {}
+ : ObjDumper(Writer), Obj(Obj), Writer(Writer), TypeDB(100) {}
void printFileHeaders() override;
void printSections() override;
@@ -109,7 +106,7 @@ private:
void printFileNameForOffset(StringRef Label, uint32_t FileOffset);
void printTypeIndex(StringRef FieldName, TypeIndex TI) {
// Forward to CVTypeDumper for simplicity.
- codeview::printTypeIndex(Writer, FieldName, TI, Types);
+ CVTypeDumper::printTypeIndex(Writer, FieldName, TI, TypeDB);
}
void printCodeViewSymbolsSubsection(StringRef Subsection,
@@ -162,8 +159,7 @@ private:
StringTableRef CVStringTable;
ScopedPrinter &Writer;
- BinaryByteStream TypeContents;
- LazyRandomTypeCollection Types;
+ TypeDatabase TypeDB;
};
class COFFObjectDumpDelegate : public SymbolDumpDelegate {
@@ -979,7 +975,9 @@ void COFFDumper::printCodeViewSymbolsSubsection(StringRef Subsection,
Subsection.bytes_end());
auto CODD = llvm::make_unique<COFFObjectDumpDelegate>(*this, Section, Obj,
SectionContents);
- CVSymbolDumper CVSD(W, Types, std::move(CODD), opts::CodeViewSubsectionBytes);
+
+ CVSymbolDumper CVSD(W, TypeDB, std::move(CODD),
+ opts::CodeViewSubsectionBytes);
CVSymbolArray Symbols;
BinaryStreamReader Reader(BinaryData, llvm::support::little);
if (auto EC = Reader.readArray(Symbols, Reader.getLength())) {
@@ -1096,11 +1094,12 @@ void COFFDumper::printCodeViewTypeSection(StringRef SectionName,
if (Magic != COFF::DEBUG_SECTION_MAGIC)
return error(object_error::parse_failed);
- Types.reset(Data);
-
- TypeDumpVisitor TDV(Types, &W, opts::CodeViewSubsectionBytes);
- error(codeview::visitTypeStream(Types, TDV));
- W.flush();
+ CVTypeDumper CVTD(TypeDB);
+ TypeDumpVisitor TDV(TypeDB, &W, opts::CodeViewSubsectionBytes);
+ if (auto EC = CVTD.dump({Data.bytes_begin(), Data.bytes_end()}, TDV)) {
+ W.flush();
+ error(llvm::errorToErrorCode(std::move(EC)));
+ }
}
void COFFDumper::printSections() {
@@ -1640,22 +1639,35 @@ void llvm::dumpCodeViewMergedTypes(ScopedPrinter &Writer,
TypeBuf.append(Record.begin(), Record.end());
});
- TypeTableCollection TpiTypes(CVTypes.records());
+ TypeDatabase TypeDB(CVTypes.records().size());
{
ListScope S(Writer, "MergedTypeStream");
- TypeDumpVisitor TDV(TpiTypes, &Writer, opts::CodeViewSubsectionBytes);
- error(codeview::visitTypeStream(TpiTypes, TDV));
- Writer.flush();
+ CVTypeDumper CVTD(TypeDB);
+ TypeDumpVisitor TDV(TypeDB, &Writer, opts::CodeViewSubsectionBytes);
+ if (auto EC = CVTD.dump(
+ {TypeBuf.str().bytes_begin(), TypeBuf.str().bytes_end()}, TDV)) {
+ Writer.flush();
+ error(std::move(EC));
+ }
}
// Flatten the id stream and print it next. The ID stream refers to names from
// the type stream.
- TypeTableCollection IpiTypes(IDTable.records());
+ SmallString<0> IDBuf;
+ IDTable.ForEachRecord([&](TypeIndex TI, ArrayRef<uint8_t> Record) {
+ IDBuf.append(Record.begin(), Record.end());
+ });
+
{
ListScope S(Writer, "MergedIDStream");
- TypeDumpVisitor TDV(TpiTypes, &Writer, opts::CodeViewSubsectionBytes);
- TDV.setIpiTypes(IpiTypes);
- error(codeview::visitTypeStream(IpiTypes, TDV));
- Writer.flush();
+ TypeDatabase IDDB(IDTable.records().size());
+ CVTypeDumper CVTD(IDDB);
+ TypeDumpVisitor TDV(TypeDB, &Writer, opts::CodeViewSubsectionBytes);
+ TDV.setItemDB(IDDB);
+ if (auto EC = CVTD.dump(
+ {IDBuf.str().bytes_begin(), IDBuf.str().bytes_end()}, TDV)) {
+ Writer.flush();
+ error(std::move(EC));
+ }
}
}
OpenPOWER on IntegriCloud