Bug 1525968 - Make local development artifact builds on Android download full build symbols. r=froydnj

We produce two types of build symbol archives in automation:

- "crashreporter-symbols.zip" contains Breakpad-format .sym files
- "crashreporter-symbols-full.zip" contains Breakpad-format .sym files
  and compressed ELF debug symbol .dbg.gz files

Right now, `--enable-artifact-build-symbols` from Bug 1305502
downloads only "crashreporter-symbols.zip".

The Android Studio version of lldb, currently 7.0.0, doesn't support
Breakpad-format .sym files. It does support (uncompressed) ELF debug
symbols.  (Note that gdb isn't supported on Android and hasn't been for
some time.)

This makes ` --enable-artifact-build-symbols` download the full
symbols for Android builds that aren't in automation, to be useful for
debugging Android builds with lldb locally.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nick Alexander 2019-03-27 22:37:40 +00:00
parent a06dbe603f
commit fbb2df205f
2 changed files with 46 additions and 3 deletions

View File

@ -31,9 +31,18 @@ imply_option('--enable-artifact-build-symbols',
option('--enable-artifact-build-symbols', nargs='?', choices=('full',),
help='Download symbols when artifact builds are enabled.')
@depends('--enable-artifact-build-symbols', 'MOZ_AUTOMATION', target)
def enable_artifact_build_symbols(value, automation, target):
if len(value):
return value[0]
if bool(value):
if target.os == 'Android' and not automation:
return 'full'
return True
return None
set_config('MOZ_ARTIFACT_BUILD_SYMBOLS',
depends('--enable-artifact-build-symbols')(
lambda v: v[0] if len(v) else (bool(v) or None)))
enable_artifact_build_symbols)
@depends('--enable-artifact-builds')
def imply_disable_compile_environment(value):

View File

@ -286,10 +286,15 @@ class ArtifactJob(object):
'matched an archive path.'.format(
patterns=LinuxArtifactJob.test_artifact_patterns))
def process_symbols_archive(self, filename, processed_filename):
def process_symbols_archive(self, filename, processed_filename, skip_compressed=False):
with JarWriter(file=processed_filename, compress_level=5) as writer:
reader = JarReader(filename)
for filename in reader.entries:
if skip_compressed and filename.endswith('.gz'):
self.log(logging.INFO, 'artifact',
{'filename': filename},
'Skipping compressed ELF debug symbol file {filename}')
continue
destpath = mozpath.join('crashreporter-symbols', filename)
self.log(logging.INFO, 'artifact',
{'destpath': destpath},
@ -334,6 +339,35 @@ class AndroidArtifactJob(ArtifactJob):
basename = mozpath.join(basedir, basename)
writer.add(basename.encode('utf-8'), f.open())
def process_symbols_archive(self, filename, processed_filename):
ArtifactJob.process_symbols_archive(self, filename, processed_filename, skip_compressed=True)
if self._symbols_archive_suffix != 'crashreporter-symbols-full.zip':
return
import gzip
with JarWriter(file=processed_filename, compress_level=5) as writer:
reader = JarReader(filename)
for filename in reader.entries:
if not filename.endswith('.gz'):
continue
# Uncompress "libxul.so/D3271457813E976AE7BF5DAFBABABBFD0/libxul.so.dbg.gz" into "libxul.so.dbg".
#
# After `settings append target.debug-file-search-paths /path/to/topobjdir/dist/crashreporter-symbols`,
# Android Studio's lldb (7.0.0, at least) will find the ELF debug symbol files.
#
# There are other paths that will work but none seem more desireable. See
# https://github.com/llvm-mirror/lldb/blob/882670690ca69d9dd96b7236c620987b11894af9/source/Host/common/Symbols.cpp#L324.
basename = os.path.basename(filename).replace('.gz', '')
destpath = mozpath.join('crashreporter-symbols', basename)
self.log(logging.INFO, 'artifact',
{'destpath': destpath},
'Adding uncompressed ELF debug symbol file {destpath} to processed archive')
writer.add(destpath.encode('utf-8'),
gzip.GzipFile(fileobj=reader[filename].uncompressed_data))
class LinuxArtifactJob(ArtifactJob):
package_re = r'public/build/target\.tar\.bz2'