Chromium Code Reviews| Index: win_toolchain/get_toolchain_if_necessary.py |
| diff --git a/win_toolchain/get_toolchain_if_necessary.py b/win_toolchain/get_toolchain_if_necessary.py |
| index dbfb0eb0e29857da8eb3f9ef4bedb797f64b42f4..d176665bef79a5c63b834f60609280dd245e73ed 100755 |
| --- a/win_toolchain/get_toolchain_if_necessary.py |
| +++ b/win_toolchain/get_toolchain_if_necessary.py |
| @@ -357,6 +357,25 @@ 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(v=vs.85).aspx |
|
scottmg
2016/03/22 19:27:44
Remove "(v=vs.85)" to make it fix in 80 col
brucedawson
2016/03/22 20:39:18
Done.
|
| + """ |
| + key_name = r'SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' |
|
scottmg
2016/03/22 19:27:44
if not sys.platform.startswith('win'):
return
b
brucedawson
2016/03/22 20:39:18
sys.platform == 'win32' seems to be standard in th
|
| + try: |
| + key = winreg.CreateKey(winreg.HKEY_LOCAL_MACHINE, key_name) |
| + # None of the settings are touched because that could over-ride user |
| + # specific settings. Merely creating LocalDumps is sufficient to enable the |
| + # defaults. |
| + key.Close() |
| + # Trap OSError instead of WindowsError so pylint will succeed on Linux. |
| + # Catching errors is important because some build machines and most user |
| + # machines are not elevated and writing to HKLM requires elevation. |
| + except OSError: |
| + return |
|
scottmg
2016/03/22 19:27:44
Normally just "pass" instead of "return" to indica
brucedawson
2016/03/22 20:39:18
Yep. I previously had the except elsewhere where '
|
| + |
| + |
| def main(): |
| parser = optparse.OptionParser(description=sys.modules[__name__].__doc__) |
| parser.add_option('--output-json', metavar='FILE', |
| @@ -471,6 +490,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) |