Bug 1576941 - be more careful about success when running dsymutil; r=nalexander
authorNathan Froyd <froydnj@mozilla.com>
Fri, 30 Aug 2019 13:35:04 +0000
changeset 554635 4ea7cebd11a3738600b4d4356984db4e5f4fe234
parent 554634 19e21bdb79cbfdc5b3a9c2323d3fcb6e28f159cc
child 554636 9d271586649f004ee40ce35fbe510c567d54c1f0
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1576941
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1576941 - be more careful about success when running dsymutil; r=nalexander Various artifacts we produce don't actually have debug symbols, but `llvm-dsymutil` will happily run on them and produce garbage for `dump_syms` to look at. Let's not do that. Differential Revision: https://phabricator.services.mozilla.com/D43772
toolkit/crashreporter/tools/symbolstore.py
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -835,31 +835,41 @@ class Dumper_Mac(Dumper):
         print("Running Mac pre-processing on file: %s" % (file,),
               file=sys.stderr)
 
         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
-        try:
-            cmd = ([dsymutil] +
-                   [a.replace('-a ', '--arch=') for a in self.archs if a] +
-                   [file])
-            print(' '.join(cmd), file=sys.stderr)
-            subprocess.check_call(cmd, stdout=open(os.devnull, 'w'))
-        except subprocess.CalledProcessError as e:
-            print('Error running dsymutil: %s' % str(e), file=sys.stderr)
-            raise
+        cmd = ([dsymutil] +
+               [a.replace('-a ', '--arch=') for a in self.archs if a] +
+               [file])
+        print(' '.join(cmd), file=sys.stderr)
+
+        dsymutil_proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+                                         stderr=subprocess.PIPE)
+        dsymout, dsymerr = dsymutil_proc.communicate()
+        if dsymutil_proc.returncode != 0:
+            raise RuntimeError('Error running dsymutil: %s' % dsymerr)
 
+        # Regular dsymutil won't produce a .dSYM for files without symbols.
         if not os.path.exists(dsymbundle):
-            # dsymutil won't produce a .dSYM for files without symbols
             print("No symbols found in file: %s" % (file,), file=sys.stderr)
             return False
 
+        # llvm-dsymutil will produce a .dSYM for files without debug
+        # symbols, but only warns you in the output and doesn't actually
+        # fail.  We don't want to run dump_syms on such bundles, because
+        # asserts will fire in debug mode and who knows what will happen
+        # in release.
+        if 'warning: no debug symbols in' in dsymerr:
+            print(dsymerr, file=sys.stderr)
+            return False
+
         elapsed = time.time() - t_start
         print('Finished processing %s in %.2fs' % (file, elapsed),
               file=sys.stderr)
         return dsymbundle
 
     def CopyDebug(self, file, debug_file, guid, code_file, code_id):
         """ProcessFile has already produced a dSYM bundle, so we should just
         copy that to the destination directory. However, we'll package it