BUILD.gn 2.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
# Copyright 2020 the V8 project 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("../../gni/v8.gni")

config("v8windbg_config") {
  # Required for successful compilation of SDK header file DbgModel.h.
  cflags_cc = [ "/Zc:twoPhase-" ]

  include_dirs = [ "../.." ]
}

# Basic support for WinDbg extensions, with nothing specific to V8.
source_set("v8windbg_base") {
  testonly = true

  sources = [
    "base/dbgext.cc",
    "base/dbgext.h",
    "base/utilities.cc",
    "base/utilities.h",
  ]

  libs = [
    "DbgEng.lib",
    "DbgModel.lib",
    "RuntimeObject.lib",
    "comsuppwd.lib",
  ]

  public_configs = [ ":v8windbg_config" ]
}

# An extension DLL that can be loaded into WinDbg with `.load v8windbg`.
v8_shared_library("v8windbg") {
  testonly = true

  sources = [
    "base/dbgext.def",
    "src/cur-isolate.cc",
    "src/cur-isolate.h",
43 44
    "src/js-stack.cc",
    "src/js-stack.h",
45 46 47 48 49 50 51 52 53 54 55 56
    "src/local-variables.cc",
    "src/local-variables.h",
    "src/object-inspection.cc",
    "src/object-inspection.h",
    "src/v8-debug-helper-interop.cc",
    "src/v8-debug-helper-interop.h",
    "src/v8windbg-extension.cc",
    "src/v8windbg-extension.h",
  ]

  deps = [
    ":v8windbg_base",
57 58 59
    "../../:v8_flags",
    "../../:v8_libbase",
    "../../:v8_shared_internal_headers",
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
    "../debug_helper:v8_debug_helper",
  ]
}

# Copies Windows SDK files that v8windbg_test needs.
action("copy_prereqs") {
  testonly = true

  script = "copy-prereqs.py"

  inputs = [
    script,
    "//build/vs_toolchain.py",
  ]

  outputs = [ "$root_out_dir/dbgeng.dll" ]

  args = [
78 79
    rebase_path("//build", root_build_dir),
    rebase_path(root_out_dir, root_build_dir),
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
    target_cpu,
  ]
}

# A test that launches a separate d8 process and debugs it using v8windbg.
v8_source_set("v8windbg_test") {
  testonly = true

  sources = [
    "test/debug-callbacks.cc",
    "test/debug-callbacks.h",
    "test/v8windbg-test.cc",
    "test/v8windbg-test.h",
  ]

  deps = [ "../..:v8_libbase" ]  # For CHECK macro.

  data_deps = [
    ":copy_prereqs",
    ":v8windbg",
    ":v8windbg_test_script",
    "../..:d8",
  ]

  libs = [
    "DbgEng.lib",
    "DbgModel.lib",
    "Pathcch.lib",
    "RuntimeObject.lib",
  ]

  configs = [ ":v8windbg_config" ]
}

# Copies the JavaScript file used by v8windbg_test.
copy("v8windbg_test_script") {
  testonly = true
  sources = [ "test/script.js" ]
  outputs = [ "$target_out_dir/v8windbg-test-script.js" ]
}