[PATCH] D50258: [llvm-pdbutil] Support PDBs without a DBI stream

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 3 11:24:18 PDT 2018


zturner added inline comments.


================
Comment at: lib/DebugInfo/PDB/Native/PDBFile.cpp:473-474
+  assert(StreamIndex < Layout.StreamSizes.size() && "Invalid stream index");
+  if (Layout.StreamSizes[StreamIndex] == 0)
+    return make_error<RawError>(raw_error_code::no_stream);
   return MappedBlockStream::createIndexedStream(Layout, MsfData, StreamIndex,
----------------
This check looks incorrect to me.  A 0-byte stream is still a stream.


================
Comment at: test/tools/llvm-pdbdump/Inputs/TypeServerTest.cpp:1
+// Compile with "cl /c /Zi TypeServerTest.cpp /FdTypeServerTest.pdb"
+
----------------
Instead of checking in source code and a binary object file, can we just check in a yaml file and run it through yaml2pdb?  If you can't get pdb2yaml to produce this file (because it also crashes), then just run pdb2yaml on a good file, and delete the DBI stream.  If it's possible to get pdb2yaml to produce a PDB with a 0-byte DBI stream, that should be sufficient to test this.

If all else fails and you really must check in binary files, then I think we only need the PDB and not the obj, and you will probably need to use `/nodefaultlib /entry:main` to keep the PDB binary small.


================
Comment at: tools/llvm-pdbutil/DumpOutputStyle.cpp:71-73
+  AutoIndent Indent(P, 4);
+  P.formatLine("Dumping this stream is not valid for object files");
+  return false;
----------------
This looks odd?  We shouldn't be printing anything inside of a predicate function.


================
Comment at: tools/llvm-pdbutil/DumpOutputStyle.cpp:79-81
+  AutoIndent Indent(P, 4);
+  P.formatLine("DBI stream not present");
+  return false;
----------------
Same here.


================
Comment at: tools/llvm-pdbutil/DumpOutputStyle.cpp:87-89
+  AutoIndent Indent(P, 4);
+  P.formatLine("Globals stream not present");
+  return false;
----------------
And here.


Repository:
  rL LLVM

https://reviews.llvm.org/D50258





More information about the llvm-commits mailing list