Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1939)

Unified Diff: build/win/copy_cdb_to_output.py

Issue 1859013002: Copy cdb.exe into telemetry_chrome_test's isolate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-windows-stack-symbolization
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/breakpad.isolate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/win/copy_cdb_to_output.py
diff --git a/build/win/copy_cdb_to_output.py b/build/win/copy_cdb_to_output.py
new file mode 100644
index 0000000000000000000000000000000000000000..aa91b3a6e1af2e290db5359163c1961e39dc7b26
--- /dev/null
+++ b/build/win/copy_cdb_to_output.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import shutil
+import sys
+
+script_dir = os.path.dirname(os.path.realpath(__file__))
+src_build_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
+sys.path.insert(0, src_build_dir)
+
+import vs_toolchain
+
+
+def _NormalizePath(path):
+ while path.endswith("\\"):
+ path = path[:-1]
+ return path
+
+
+def _CopyImpl(file_name, target_dir, source_dir, verbose=True):
+ """Copy |source| to |target| if it doesn't already exist or if it
+ needs to be updated.
+ """
+ target = os.path.join(target_dir, file_name)
+ source = os.path.join(source_dir, file_name)
+ if (os.path.isdir(os.path.dirname(target)) and
+ (not os.path.isfile(target) or
+ os.stat(target).st_mtime != os.stat(source).st_mtime)):
scottmg 2016/04/05 16:41:28 +1 space on this line, otherwise it's a bit mislea
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 Done.
+ if verbose:
+ print 'Copying %s to %s...' % (source, target)
+ if os.path.exists(target):
+ os.unlink(target)
+ shutil.copy2(source, target)
+
+
+def _CopyCDBToOutput(output_dir, target_arch):
+ """Copies the Windows debugging executable cdb.exe to the output
+ directory. The output directory, and target architecture that should
+ be copied, are passed. Supported values for the target architecture
+ are the GYP values "ia32" and "x64".
+ """
+ vs_runtime_dll_dirs = vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
M-A Ruel 2016/04/05 10:41:06 Does this work when it finds the directory in c:\p
scottmg 2016/04/05 16:41:28 You don't use the return value here, just remove t
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 Done.
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 It shouldn't find it there -- that script is what
+ win_sdk_dir = _NormalizePath(os.environ['WINDOWSSDKDIR'])
scottmg 2016/04/05 16:41:28 How about `os.path.normpath(os.environ['WINDOWSSDK
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 Sure. I was just following the pattern in vs_toolc
+ if target_arch == 'ia32':
+ src_arch = 'x86'
+ elif target_arch == 'x64':
+ src_arch = 'x64'
+ else:
+ print 'copy_cdb_to_output.py: unknown target_arch %s' % target_arch
+ sys.exit(1)
+ # We need to copy multiple files, so cache the computed source directory.
+ src_dir = os.path.join(win_sdk_dir, 'Debuggers', src_arch)
+ _CopyImpl('cdb.exe', output_dir, src_dir)
scottmg 2016/04/05 16:41:28 Hopefully this set is sufficient. Note here that t
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 Added a note. Will update this set, and the isolat
+ _CopyImpl('dbgeng.dll', output_dir, src_dir)
+ _CopyImpl('dbghelp.dll', output_dir, src_dir)
+ _CopyImpl('dbgmodel.dll', output_dir, src_dir)
+ return 0
+
+
+def main():
+ if len(sys.argv) < 2:
+ print >>sys.stderr, 'Usage: copy_cdb_to_output.py [output_dir] ' + \
scottmg 2016/04/05 16:41:28 nit; normally [] indicate optional arguments, but
Ken Russell (switch to Gerrit) 2016/04/05 17:18:09 Changed to use <>.
+ '[target_arch]'
+ return 1
+ return _CopyCDBToOutput(sys.argv[1], sys.argv[2])
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « no previous file | chrome/breakpad.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698