This is an archive of the discontinued LLVM Phabricator instance.

Make llvm-readobj symbol dumper use the RecordIterator
Needs RevisionPublic

Authored by zturner on May 9 2016, 10:54 AM.

Details

Reviewers
amccarth
rnk
Summary

Note that this doesn't go quite far enough. In a subsequent patch I will convert the symbol dumper to a visitor pattern, and move this into libcodeview just like CVTypeDumper. For now, this is the first step towards that, and a proof of concept that the RecordIterator is generic enough to handle more than just types.

Diff Detail

Event Timeline

zturner updated this revision to Diff 56596.May 9 2016, 10:54 AM
zturner retitled this revision from to Make llvm-readobj symbol dumper use the RecordIterator.
zturner updated this object.
zturner added reviewers: rnk, amccarth.
zturner added a subscriber: llvm-commits.
rnk requested changes to this revision.May 9 2016, 11:02 AM
rnk edited edge metadata.

So, while llvm-readobj may not have error handling, it *does* have very careful bounds checking, and I really want to keep it. This was an important part of our refactor away from DataExtractor to StringRef / consumeObject.

include/llvm/DebugInfo/CodeView/RecordIterator.h
35

This also loses the bounds checking we had before.

include/llvm/DebugInfo/CodeView/SymbolRecord.h
57

Please don't do this, the old code was very careful to avoid buffer overruns when the string was not null terminated. It also throws off consumeObject, which will consume one extra byte, so SymData / LeafData won't hold the full string.

tools/llvm-readobj/COFFDumper.cpp
1019

If there is no terminating nul, split('\0') would give you all of SymData. I think that's the best behavior we can hope for.

This revision now requires changes to proceed.May 9 2016, 11:02 AM