1#!/usr/bin/env python
2# Copyright 2020 the V8 project authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""This program copies dbgeng.dll from the Windows SDK to the output directory,
7so that we can test v8windbg. (The version of dbgeng.dll in system32, which
8would be loaded otherwise, is insufficient.)
9Arguments:
101. The directory that contains vs_toolchain.py
112. The directory to copy to
123. The cpu type for this build
13"""
14
15import sys
16import os
17
18vs_toolchain_dir, target_dir, target_cpu = sys.argv[1:]
19
20sys.path.insert(0, vs_toolchain_dir)
21import vs_toolchain
22
23def CopyDebuggerFile(debug_file):
24  win_sdk_dir = vs_toolchain.SetEnvironmentAndGetSDKDir()
25  if not win_sdk_dir:
26    return
27
28  full_path = os.path.join(win_sdk_dir, 'Debuggers', target_cpu, debug_file)
29  if not os.path.exists(full_path):
30    return
31
32  target_path = os.path.join(target_dir, debug_file)
33  vs_toolchain._CopyRuntimeImpl(target_path, full_path, verbose=False)
34
35  # Ninja expects the file's timestamp to be newer than this script.
36  os.utime(target_path, None)
37
38CopyDebuggerFile('dbgeng.dll')
39