[PATCH] D51951: [PDB] Write FPO Data to the PDB

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 14:50:11 PDT 2018


zturner created this revision.
zturner added a reviewer: rnk.
Herald added subscribers: mgrang, hiraditya.

In x86 builds, we write a FrameData subsection to the COFF object file, that is used to help in unwinding.  However, we weren't writing any of this data to the PDB.  This would cause incorrect local variable display when debugging 32-bit binaries in certain scenarios.  This patch emits the fpo data stream.

I confirmed using the reproducer from https://bugs.llvm.org/show_bug.cgi?id=38857 that without my patch, local variable display is garbage, and after my patch local variable display is correct.

There are two fixups that need to be done on a `FrameData` record before copying it to the PDB.  The first is that the object file contains a relocation offset for each group of frame data entries.  That needs to be added to each entry's RVA before writing it.  The second is that the `FrameData` has a field which refers to the object file's local string table.  This needs to be translated into an offset that is valid in the PDB's merged / global string table.  All of the other fields can just be copied over.

I also added facility to `llvm-pdbutil` to dump the fpo data, and confirmed that we output data matching `cvdump -fpo` given the same PDB.


https://reviews.llvm.org/D51951

Files:
  lld/COFF/PDB.cpp
  lld/test/COFF/pdb-framedata.yaml
  lld/test/COFF/pdb-linker-module.test
  llvm/include/llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h
  llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h
  llvm/lib/DebugInfo/CodeView/DebugFrameDataSubsection.cpp
  llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.h
  llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51951.164976.patch
Type: text/x-patch
Size: 34564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/ffdc5fa8/attachment.bin>


More information about the llvm-commits mailing list