This is an archive of the discontinued LLVM Phabricator instance.

[PDB] Write FPO Data to the PDB
AcceptedPublic

Authored by zturner on Sep 11 2018, 2:47 PM.

Details

Reviewers
rnk
Summary

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.

Diff Detail

Event Timeline

zturner created this revision.Sep 11 2018, 2:47 PM
rnk accepted this revision.Sep 11 2018, 3:19 PM

lgtm

We should add old FPO data dumping next.

This revision is now accepted and ready to land.Sep 11 2018, 3:19 PM