--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -16,16 +16,17 @@
# -c : Copy debug info files to the same directory structure
# as sym files. On Windows, this will also copy
# binaries into the symbol store.
# -a "<archs>" : Run dump_syms -a <arch> for each space separated
# cpu architecture in <archs> (only on OS X)
# -s <srcdir> : Use <srcdir> as the top source directory to
# generate relative filenames.
+import buildconfig
import errno
import sys
import platform
import os
import re
import shutil
import textwrap
import fnmatch
@@ -321,23 +322,19 @@ def make_file_mapping(install_manifests)
if hasattr(src, 'path'):
abs_dest = os.path.normpath(os.path.join(destination, dst))
file_mapping[abs_dest] = src.path
return file_mapping
def GetPlatformSpecificDumper(**kwargs):
"""This function simply returns a instance of a subclass of Dumper
that is appropriate for the current platform."""
- # Python 2.5 has a bug where platform.system() returns 'Microsoft'.
- # Remove this when we no longer support Python 2.5.
- return {'Windows': Dumper_Win32,
- 'Microsoft': Dumper_Win32,
+ return {'WINNT': Dumper_Win32,
'Linux': Dumper_Linux,
- 'Sunos5': Dumper_Solaris,
- 'Darwin': Dumper_Mac}[platform.system()](**kwargs)
+ 'Darwin': Dumper_Mac}[buildconfig.substs['OS_ARCH']](**kwargs)
def SourceIndex(fileStream, outputPath, vcs_root):
"""Takes a list of files, writes info to a data block in a .stream file"""
# Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
# Create the srcsrv data block that indexes the pdb file
result = True
pdbStreamFile = open(outputPath, "w")
pdbStreamFile.write('''SRCSRV: ini ------------------------------------------------\r\nVERSION=2\r\nINDEXVERSION=2\r\nVERCTRL=http\r\nSRCSRV: variables ------------------------------------------\r\nHGSERVER=''')
@@ -614,18 +611,19 @@ class Dumper:
# our result is a status, a cleanup function, an argument to that function, and the tuple of files we were called on
result = { 'status' : False, 'after' : after, 'after_arg' : after_arg, 'files' : files }
sourceFileStream = ''
code_id, code_file = None, None
for file in files:
# files is a tuple of files, containing fallbacks in case the first file doesn't process successfully
try:
- proc = subprocess.Popen([self.dump_syms] + arch.split() + [file],
- stdout=subprocess.PIPE)
+ cmd = [self.dump_syms] + arch.split() + [file]
+ self.output_pid(sys.stderr, ' '.join(cmd))
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
module_line = proc.stdout.next()
if module_line.startswith("MODULE"):
# MODULE os cpu guid debug_file
(guid, debug_file) = (module_line.split())[3:5]
# strip off .pdb extensions, and append .sym
sym_file = re.sub("\.pdb$", "", debug_file) + ".sym"
# we do want forward slashes here
rel_path = os.path.join(debug_file,
@@ -897,20 +895,27 @@ class Dumper_Mac(Dumper):
self.output_pid(sys.stderr, "Worker running Mac pre-processing on file: %s" % (file,))
# our return is a status and a tuple of files to dump symbols for
# the extra files are fallbacks; as soon as one is dumped successfully, we stop
result = { 'status' : False, 'files' : None, 'file_key' : file }
dsymbundle = file + ".dSYM"
if os.path.exists(dsymbundle):
shutil.rmtree(dsymbundle)
+ dsymutil = buildconfig.substs['DSYMUTIL']
# dsymutil takes --arch=foo instead of -a foo like everything else
- subprocess.call(["dsymutil"] + [a.replace('-a ', '--arch=') for a in self.archs if a]
- + [file],
- stdout=open(os.devnull, 'w'))
+ try:
+ cmd = ([dsymutil] +
+ [a.replace('-a ', '--arch=') for a in self.archs if a] +
+ [file])
+ self.output_pid(sys.stderr, ' '.join(cmd))
+ subprocess.check_call(cmd, stdout=open(os.devnull, 'w'))
+ except subprocess.CalledProcessError as e:
+ self.output_pid(sys.stderr, 'Error running dsymutil: %s' % str(e))
+
if not os.path.exists(dsymbundle):
# dsymutil won't produce a .dSYM for files without symbols
self.output_pid(sys.stderr, "No symbols found in file: %s" % (file,))
result['status'] = False
result['files'] = (file, )
return result
result['status'] = True