This is an archive of the discontinued LLVM Phabricator instance.

Allow subsections in raw output mode to be printed in the order they appear in the file.
ClosedPublic

Authored by zturner on Jun 7 2017, 3:59 PM.

Details

Summary

This is the same change that was made for the YAML output style, but applied to the raw output style.

The problem is the same as before. You have to know about checksums before you can print many other sections, even though checksums might not appear until later. To handle this we create a DebugVisitorState that holds a pointer to the string table and checkums subsection, and the user can specify as much or as little as possible of this. Whatever is not filled out initially will be scanned for before doing the actual visitation with callback invocations. All of this is hidden, so the user just has to call the visitor and it just works

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.Jun 7 2017, 3:59 PM
zturner retitled this revision from Allow subsections in raw output mode to be printed out of order to Allow subsections in raw output mode to be printed in the order they appear in the file..Jun 7 2017, 5:34 PM
zturner removed a reviewer: hiraditya.
inglorion added inline comments.Jun 8 2017, 2:31 PM
llvm/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h
29 ↗(On Diff #101836)

Since you have both public and private members, please declare this as a class instead of a struct.

llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
39 ↗(On Diff #101836)

Should it be an error if you call initializeStrings when Strings is already set? Or should we at least assert against it? Same with checksums below.

zturner marked an inline comment as done.Jun 8 2017, 2:33 PM
zturner added inline comments.
llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
39 ↗(On Diff #101836)

I tried that, and it causes problems in follow-up patches. PDB has a global string table, but string tables can also appear inside of debug subsections. This isn't really supposed to happen in practice (they appear in the .debug$S section in object files, but in the global string table in PDB files), but it's useful to be able to test proper operation of the StringTable subsection by manually constructing one with both a global and local string table. So I ended up removing the check.

This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/DebugInfo/PDB/pdbdump-headers.test