Skip to content

Commit

Permalink
Bug 1588538 - Use the new Windows dump_syms tool to dump symbols in l…
Browse files Browse the repository at this point in the history
…ocal builds r=glandium

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

--HG--
extra : moz-landing-system : lando
  • Loading branch information
gabrielesvelto committed Jan 14, 2020
1 parent 597ca0a commit e62e144
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 65 deletions.
1 change: 1 addition & 0 deletions browser/config/mozconfigs/win64/plain-opt
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
1 change: 1 addition & 0 deletions build/moz.configure/toolchain.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
)]
Expand Down
1 change: 1 addition & 0 deletions build/mozconfig.win-common
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions python/mozboot/mozboot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ def ensure_node_packages(self, state_dir, checkout_root):
'%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):
Expand Down
1 change: 1 addition & 0 deletions python/mozboot/mozboot/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def maybe_install_private_packages_or_exit(self, state_dir,
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.
Expand Down
5 changes: 5 additions & 0 deletions python/mozboot/mozboot/mozillabuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ def ensure_node_packages(self, state_dir, checkout_root):
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

Expand Down
19 changes: 7 additions & 12 deletions python/mozbuild/mozbuild/action/dumpsymbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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',
Expand Down

This file was deleted.

3 changes: 0 additions & 3 deletions toolkit/crashreporter/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down
9 changes: 3 additions & 6 deletions toolkit/crashreporter/tools/unit-symbolstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,9 @@ def setUp(self):
'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')
Expand Down
25 changes: 25 additions & 0 deletions toolkit/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 0 additions & 8 deletions tools/crashreporter/app.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]

0 comments on commit e62e144

Please sign in to comment.