Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.

Commit b89a373

Browse files
committed
Add mspdbcmf (un-fastlink) support to StripChromeSymbols.py
When binaries are built with /debug:fastlink they are smaller and require less copying of data, but they cannot be stripped by pdbcopy.exe. This means that StripChromeSymbols.py fails with locally built binaries if /debug:fastlink is used, which gets us back to WPA taking ~25 minutes to process Chrome's symbols. This change automatically runs mspdbcmf.exe (if present) if pdbcopy fails. Hacks upon hacks upon hacks. All of this could be avoided if WPA could load Chrome's symbols quickly. Someday... This fixes issue #77
1 parent 6853487 commit b89a373

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

bin/StripChromeSymbols.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ def main():
7070
if os.path.exists(pdbcopy_install):
7171
pdbcopy_path = pdbcopy_install
7272

73+
# This tool converts PDBs created with /debug:fastlink (VC++ 2015 feature) to
74+
# regular PDBs that contain all of the symbol information directly. This is
75+
# required so that pdbcopy can copy the symbols.
76+
un_fastlink_tool = r"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\mspdbcmf.exe"
77+
if not os.path.exists(un_fastlink_tool):
78+
un_fastlink_tool = None
79+
7380
# RetrieveSymbols.exe requires some support files. dbghelp.dll and symsrv.dll
7481
# have to be in the same directory as RetrieveSymbols.exe and pdbcopy.exe must
7582
# be in the path, so copy them all to the script directory.
@@ -167,9 +174,25 @@ def main():
167174
# it to fail. So don't do that.
168175
copy_command = '%s "%s" "%s" -p' % (pdbcopy_path, pdb_cache_path, dest_path)
169176
print(" > %s" % copy_command)
170-
output = str(subprocess.check_output(copy_command, stderr=subprocess.STDOUT))
171-
if output:
172-
print(" %s" % output, end="")
177+
if un_fastlink_tool:
178+
# If the un_fastlink_tool is available then run the pdbcopy command in a
179+
# try block. If pdbcopy fails then run the un_fastlink_tool and try again.
180+
try:
181+
output = str(subprocess.check_output(copy_command, stderr=subprocess.STDOUT))
182+
if output:
183+
print(" %s" % output, end="")
184+
except:
185+
convert_command = '%s "%s"' % (un_fastlink_tool, pdb_cache_path)
186+
print("Attempting to un-fastlink PDB so that pdbcopy can strip it. This may be slow.")
187+
print(" > %s" % convert_command)
188+
subprocess.check_output(convert_command)
189+
output = str(subprocess.check_output(copy_command, stderr=subprocess.STDOUT))
190+
if output:
191+
print(" %s" % output, end="")
192+
else:
193+
output = str(subprocess.check_output(copy_command, stderr=subprocess.STDOUT))
194+
if output:
195+
print(" %s" % output, end="")
173196
if not os.path.exists(dest_path):
174197
print("Aborting symbol generation because stripped PDB '%s' does not exist. WPA symbol loading may be slow." % dest_path)
175198
sys.exit(0)

0 commit comments

Comments
 (0)