This is an archive of the discontinued LLVM Phabricator instance.

Default to standalone debug info on Windows
AcceptedPublic

Authored by rnk on Dec 16 2016, 11:51 AM.

Details

Summary

PDB-based debuggers do not support looking up type names across type
stream boundaries. There are two ways where users end up being unable to
look into variables with types that were required to be complete:

  1. The type was provided by another DLL, but was not marked dllimport. In this case, the type stream is in the PDB, and it will contain all types that had complete definitions within the DLL. If the type had a vtable that was only emitted in another DLL, we will not have type information for it.
  1. The user is using /DEBUG:FASTLINK. This flag tells the linker to leave debug information in object files, similar to the default build flow on MacOS. When /DEBUG:FASTLINK is used with /Z7, each individual object file needs to have complete definitions of all types required to be complete in that TU. This isn't so bad for MSVC because it supports using type servers with /Zi, so they still get some amount of type deduplication.

I did an experiment some time ago on Chrome and found that changing the
default here increased the object file sizes in a Chrome debug build by
17%[1], which is quite significant. If those savings are important to
users and they aren't using /DEBUG:FASTLINK, they can opt into limited
debug info by passing -flimit-debug-info.

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=642812#c15

Event Timeline

rnk updated this revision to Diff 81783.Dec 16 2016, 11:51 AM
rnk retitled this revision from to Default to standalone debug info on Windows.
rnk updated this object.
rnk added reviewers: thakis, hans, dblaikie.
rnk added a subscriber: cfe-commits.
dblaikie accepted this revision.Dec 16 2016, 11:54 AM
dblaikie edited edge metadata.
This revision is now accepted and ready to land.Dec 16 2016, 11:54 AM
thakis edited edge metadata.Dec 16 2016, 11:59 AM

Did you measure what this does to link times?

rnk added a comment.Dec 16 2016, 1:39 PM

Did you measure what this does to link times?

No, but I plan to recover it in Chromium by doing something like:

if (is_win && is_clang && !is_win_fastlink) {
  cflags += ["-flimit-debug-info"]
}
rnk added a comment.Dec 16 2016, 3:07 PM

Did you measure what this does to link times?

I've measured now, and it's pretty bad. Times to link blink_core increase by 39% with -fstandalone-debug (211s -> 294s). I still think it's what we should do by default.

There's other things we can do with PCH to have less duplicate debug info when not using /debug:fastlink.