Enable crash dump collection on builders

Toolchain crashes on build machines are an ongoing problem, particularly
with the VC++ 2015 migration. Setting this registry key tells Windows
Error Reporting to record minidumps (a few MB typically) to a local
directory, up to a maximum of ten. This should help with investigations.

This change also suppresses Windows Error Reporting dialogs with the
DontShowUI registry value, to avoid builder hangs on crashes.

See also crrev.com/1816333002

BUG=440500

Review URL: https://codereview.chromium.org/1825163003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299426 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b860674
......@@ -357,6 +357,27 @@ def InstallUniversalCRTIfNeeded(abs_target_dir):
return
def EnableCrashDumpCollection():
"""Tell Windows Error Reporting to record crash dumps so that we can diagnose
linker crashes and other toolchain failures. Documented at:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181.aspx
"""
if sys.platform == 'win32' and os.environ.get('CHROME_HEADLESS') == '1':
key_name = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting'
try:
key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_name)
# Merely creating LocalDumps is sufficient to enable the defaults.
winreg.CreateKey(key, "LocalDumps")
# Disable the WER UI, as documented here:
# https://msdn.microsoft.com/en-us/library/windows/desktop/bb513638.aspx
winreg.SetValueEx(key, "DontShowUI", 0, winreg.REG_DWORD, 1)
# Trap OSError instead of WindowsError so pylint will succeed on Linux.
# Catching errors is important because some build machines are not elevated
# and writing to HKLM requires elevation.
except OSError:
pass
def main():
parser = optparse.OptionParser(description=sys.modules[__name__].__doc__)
parser.add_option('--output-json', metavar='FILE',
......@@ -471,6 +492,8 @@ def main():
shutil.copyfile(os.path.join(target_dir, '..', 'data.json'),
options.output_json)
EnableCrashDumpCollection()
if os.environ.get('GYP_MSVS_VERSION') == '2015':
InstallUniversalCRTIfNeeded(abs_toolchain_target_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment