[PATCH] D32547: [CodeView] Isolate the parsing code for various types of CV debug info fragments

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 10:54:45 PDT 2017


zturner created this revision.
Herald added subscribers: aprantl, mgorny.

There are many different types of debug info about modules, such as line information, checksum information, symbol info, etc.  in the existing code, we have a single "visitor" class which knows how to parse all the different types, and invokes a callback interface with the results.

Once we begin trying to write this information, this monolithic model becomes difficult to work with, because reading and writing share enough similarities that they should be grouped together whenever possible, but enough differences that you can't always do an exact mapping of the code.

For this reason, it would help if the knowledge of how to parse each type of module debug info fragment were isolated from the others in its own class.  This way we could provide useful accessors on these classes for querying fields from the parsed format, or iterating over fields with ranged based fors, or methods to add new items to a list.

In short, the individual fragment types are complicated enough that it makes sense to have their knowledge wrapped up in individual classes designed to be able to query / manipulate / deserialize / serialize them.

In doing so, I found an instance where parsing code was duplicated.  Once in llvm-readobj which had its own code for parsing the FileChecksums fragment, and once in llvm-pdbdump where it used the code in DebugInfo/CodeView to do the same thing.  When the llvm-readobj code to use the CodeView code (which made the code much simpler), this surfaced a bug in the CodeView implementation where we did not account for alignment, so this has been fixed as well.


https://reviews.llvm.org/D32547

Files:
  llvm/include/llvm/DebugInfo/CodeView/Line.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFragment.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentRecord.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugLineFragment.h
  llvm/include/llvm/DebugInfo/CodeView/ModuleDebugUnknownFragment.h
  llvm/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
  llvm/lib/DebugInfo/CodeView/CMakeLists.txt
  llvm/lib/DebugInfo/CodeView/ModuleDebugFileChecksumFragment.cpp
  llvm/lib/DebugInfo/CodeView/ModuleDebugFragment.cpp
  llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentRecord.cpp
  llvm/lib/DebugInfo/CodeView/ModuleDebugFragmentVisitor.cpp
  llvm/lib/DebugInfo/CodeView/ModuleDebugLineFragment.cpp
  llvm/lib/DebugInfo/CodeView/ModuleDebugUnknownFragment.cpp
  llvm/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp
  llvm/tools/llvm-pdbdump/LLVMOutputStyle.cpp
  llvm/tools/llvm-pdbdump/YAMLOutputStyle.cpp
  llvm/tools/llvm-readobj/COFFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32547.96786.patch
Type: text/x-patch
Size: 45035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170426/a1ed181e/attachment-0001.bin>


More information about the llvm-commits mailing list