diff options
author | Reid Kleckner <rnk@google.com> | 2016-05-31 18:45:36 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-05-31 18:45:36 +0000 |
commit | fbdbe9e22ba3a383fff73546ff59b94f8a46f595 (patch) | |
tree | baafed3a6f17cdf913171072f294c03aef771530 /llvm/tools/llvm-readobj/COFFDumper.cpp | |
parent | 7aa4d977eaf3bf8122263227a6af3f5bd32390fd (diff) | |
download | bcm5719-llvm-fbdbe9e22ba3a383fff73546ff59b94f8a46f595.tar.gz bcm5719-llvm-fbdbe9e22ba3a383fff73546ff59b94f8a46f595.zip |
[codeview] Improve readability of type record assembly
Adds the method MCStreamer::EmitBinaryData, which is usually an alias
for EmitBytes. In the MCAsmStreamer case, it is overridden to emit hex
dump output like this:
.byte 0x0e, 0x00, 0x08, 0x10
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x10, 0x00, 0x00
Also, when verbose asm comments are enabled, this patch prints the dump
output for each comment before its record, like this:
# ArgList (0x1000) {
# TypeLeafKind: LF_ARGLIST (0x1201)
# NumArgs: 0
# Arguments [
# ]
# }
.byte 0x06, 0x00, 0x01, 0x12
.byte 0x00, 0x00, 0x00, 0x00
This should make debugging easier and testing more convenient.
Reviewers: aaboud
Subscribers: majnemer, zturner, amccarth, aaboud, llvm-commits
Differential Revision: http://reviews.llvm.org/D20711
llvm-svn: 271313
Diffstat (limited to 'llvm/tools/llvm-readobj/COFFDumper.cpp')
-rw-r--r-- | llvm/tools/llvm-readobj/COFFDumper.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/tools/llvm-readobj/COFFDumper.cpp b/llvm/tools/llvm-readobj/COFFDumper.cpp index 0949436a8f3..fccfd465c57 100644 --- a/llvm/tools/llvm-readobj/COFFDumper.cpp +++ b/llvm/tools/llvm-readobj/COFFDumper.cpp @@ -63,7 +63,7 @@ public: friend class COFFObjectDumpDelegate; COFFDumper(const llvm::object::COFFObjectFile *Obj, ScopedPrinter &Writer) : ObjDumper(Writer), Obj(Obj), - CVTD(Writer, opts::CodeViewSubsectionBytes) {} + CVTD(&Writer, opts::CodeViewSubsectionBytes) {} void printFileHeaders() override; void printSections() override; @@ -1495,13 +1495,10 @@ void llvm::dumpCodeViewMergedTypes( // Flatten it first, then run our dumper on it. ListScope S(Writer, "MergedTypeStream"); SmallString<0> Buf; - CVTypes.ForEachRecord([&](TypeIndex TI, MemoryTypeTableBuilder::Record *R) { - // The record data doesn't include the 16 bit size. - Buf.push_back(R->size() & 0xff); - Buf.push_back((R->size() >> 8) & 0xff); - Buf.append(R->data(), R->data() + R->size()); + CVTypes.ForEachRecord([&](TypeIndex TI, StringRef Record) { + Buf.append(Record.begin(), Record.end()); }); - CVTypeDumper CVTD(Writer, opts::CodeViewSubsectionBytes); + CVTypeDumper CVTD(&Writer, opts::CodeViewSubsectionBytes); if (!CVTD.dump({Buf.str().bytes_begin(), Buf.str().bytes_end()})) { Writer.flush(); error(object_error::parse_failed); |