Bug 1588538 - Use the new Windows dump_syms tool to dump symbols in local builds r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D57094

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gabriele Svelto 2020-01-14 10:08:52 +00:00
parent 597ca0a67b
commit e62e144c3c
12 changed files with 50 additions and 65 deletions

View File

@ -1,6 +1,7 @@
TOOLTOOL_DIR=${topsrcdir}
export MAKECAB=$TOOLTOOL_DIR/makecab.exe
export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"
export DUMP_SYMS="${MOZ_FETCHES_DIR}/dump_syms/dump_syms.exe"
RUSTC="${MOZ_FETCHES_DIR}/rustc/bin/rustc"
CARGO="${MOZ_FETCHES_DIR}/rustc/bin/cargo"

View File

@ -714,6 +714,7 @@ def toolchain_search_path_for(host_or_target):
os.path.join(mozbuild_state_path, *rest) for rest in (
['clang', 'bin'],
['cbindgen'],
['dump_syms'],
['nasm'],
['lucetc'],
)]

View File

@ -4,6 +4,7 @@
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
export MAKECAB=$TOOLTOOL_DIR/makecab.exe
export DUMP_SYMS="${MOZ_FETCHES_DIR}/dump_syms/dump_syms.exe"
if [ -z "$USE_ARTIFACT" ]; then
if [ -n "$TASKCLUSTER_PGO_PROFILE_USE" ]; then

View File

@ -312,6 +312,12 @@ class BaseBootstrapper(object):
'%s does not yet implement ensure_node_packages()'
% __name__)
def ensure_dump_syms_packages(self, state_dir, checkout_root):
'''
Install dump_syms.
'''
pass
def install_toolchain_static_analysis(self, state_dir, checkout_root, toolchain_job):
clang_tools_path = os.path.join(state_dir, 'clang-tools')
if not os.path.exists(clang_tools_path):

View File

@ -400,6 +400,7 @@ class Bootstrapper(object):
self.instance.ensure_sccache_packages(state_dir, checkout_root)
self.instance.ensure_lucetc_packages(state_dir, checkout_root)
self.instance.ensure_wasi_sysroot_packages(state_dir, checkout_root)
self.instance.ensure_dump_syms_packages(state_dir, checkout_root)
def check_telemetry_opt_in(self, state_dir):
# We can't prompt the user.

View File

@ -136,6 +136,11 @@ class MozillaBuildBootstrapper(BaseBootstrapper):
self.install_toolchain_artifact(
state_dir, checkout_root, node_artifact)
def ensure_dump_syms_packages(self, state_dir, checkout_root):
from mozboot import dump_syms
self.install_toolchain_artifact(state_dir, checkout_root, dump_syms.WIN64_DUMP_SYMS)
def _update_package_manager(self):
pass

View File

@ -32,19 +32,16 @@ def dump_symbols(target, tracking_file, count_ctors=False):
dump_syms_bin = None
dump_syms_binaries = []
# Prefer the `dump_syms` toolchain.
fetches_dir = os.environ.get('MOZ_FETCHES_DIR')
if fetches_dir:
dump_syms_binaries.append(
os.path.join(fetches_dir, 'dump_syms', 'dump_syms'))
default_bin = buildconfig.substs.get('DUMP_SYMS')
if default_bin:
dump_syms_binaries.append(default_bin)
# Fallback to the in-tree breakpad version.
dump_syms_binaries.append(os.path.join(buildconfig.topobjdir,
'dist', 'host',
'bin', 'dump_syms'))
dump_syms_binaries.append(
os.path.join(buildconfig.topobjdir, 'dist', 'host', 'bin',
'dump_syms' + buildconfig.substs['BIN_SUFFIX']))
for b in dump_syms_binaries:
dump_syms_bin = '%s%s' % (b, buildconfig.substs['BIN_SUFFIX'])
for dump_syms_bin in dump_syms_binaries:
if os.path.exists(dump_syms_bin):
break
@ -53,8 +50,6 @@ def dump_symbols(target, tracking_file, count_ctors=False):
sym_store_args.extend(['-c', '--vcs-info'])
if os.environ.get('PDBSTR_PATH'):
sym_store_args.append('-i')
os.environ['PATH'] = os.pathsep.join((buildconfig.substs['WIN_DIA_SDK_BIN_DIR'],
os.environ['PATH']))
elif os_arch == 'Darwin':
cpu = {
'x86': 'i386',

View File

@ -1,36 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
HostProgram('dump_syms')
HOST_SOURCES += [
'../../../common/windows/dia_util.cc',
'../../../common/windows/guid_string.cc',
'../../../common/windows/omap.cc',
'../../../common/windows/pdb_source_line_writer.cc',
'../../../common/windows/string_utils.cc',
'dump_syms.cc',
]
HOST_CXXFLAGS += [
'-O2',
]
if CONFIG['HOST_CC_TYPE'] == 'clang-cl':
HOST_CXXFLAGS += [
'-EHsc',
'-MD'
]
HOST_OS_LIBS += [
'dbghelp',
'diaguids',
'imagehlp',
]
LOCAL_INCLUDES += [
'../../..'
]

View File

@ -31,9 +31,6 @@ if CONFIG['MOZ_CRASHREPORTER']:
'breakpad-windows-libxul',
]
if CONFIG['WIN_DIA_SDK_BIN_DIR']:
DIRS += ['google-breakpad/src/tools/windows/dump_syms']
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
DIRS += ['breakpad-windows-standalone']

View File

@ -477,12 +477,9 @@ class TestFunctional(HelperMixin, unittest.TestCase):
'crashreporter', 'tools',
'symbolstore.py')
if target_platform() == 'WINNT':
if buildconfig.substs['WIN_DIA_SDK_BIN_DIR']:
self.dump_syms = os.path.join(buildconfig.topobjdir,
'dist', 'host', 'bin',
'dump_syms.exe')
else:
self.skip_test = True
fetches_dir = os.environ.get('MOZ_FETCHES_DIR')
self.dump_syms = os.path.join(fetches_dir, 'dump_syms',
'dump_syms.exe')
self.target_bin = os.path.join(buildconfig.topobjdir,
'dist', 'bin',
'firefox.exe')

View File

@ -1939,3 +1939,28 @@ def fogotype(milestone):
set_config('MOZ_FOGOTYPE', True, when=fogotype)
set_define('MOZ_FOGOTYPE', True, when=fogotype)
# dump_syms
# ==============================================================
option(env='DUMP_SYMS', nargs=1, when=compile_environment & target_is_windows,
help='Path to dump_syms')
@depends('DUMP_SYMS', toolchain_search_path, when=compile_environment & target_is_windows)
@checking('for dump_syms')
@imports(_from='textwrap', _import='dedent')
def dump_syms(dump_syms_override, toolchain_search_path):
if dump_syms_override:
return dump_syms_override[0]
program = find_program('dump_syms', paths=toolchain_search_path)
if program:
return program
raise FatalCheckError(dedent('''\
Cannot find dump_syms. Please run `mach bootstrap`, `cargo install dump_syms`,
ensure that `dump_syms` is on your PATH, or point at an executable with `DUMP_SYMS`.
'''))
set_config('DUMP_SYMS', dump_syms)

View File

@ -22,11 +22,3 @@ if CONFIG['OS_ARCH'] == 'Darwin':
'/toolkit/crashreporter/google-breakpad/src/common/mac',
'/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms',
]
# While the Linux and Mac dump_syms can be cross-built, the Windows one can't,
# and at the moment, it's a host tool, so only build it when the host is
# Windows.
if CONFIG['HOST_OS_ARCH'] == 'WINNT':
DIRS += [
'/toolkit/crashreporter/google-breakpad/src/tools/windows/dump_syms',
]