bug 420474 - upload debug info for Linux and mac builds to symbol server. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Wed, 11 Mar 2009 11:56:57 -0400
changeset 26051 dbd5b5c6710c796ddffa8271022c1ac09039aea7
parent 26050 9088b4cee030a012667c722f0e83d054753a2dec
child 26052 5ff0bc2194db798390f015bee56b6b8df3f295ec
push idunknown
push userunknown
push dateunknown
reviewersbsmedberg
bugs420474
milestone1.9.2a1pre
bug 420474 - upload debug info for Linux and mac builds to symbol server. r=bsmedberg
Makefile.in
toolkit/crashreporter/tools/symbolstore.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -157,26 +157,26 @@ MAKE_SYM_STORE_ARGS += --vcs-info
 endif
 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms.exe
 # PDB files don't get moved to dist, so we need to scan the whole objdir
 MAKE_SYM_STORE_PATH := .
 endif
 ifeq ($(OS_ARCH),Darwin)
 # need to pass arch flags for universal builds
 ifdef UNIVERSAL_BINARY
-MAKE_SYM_STORE_ARGS := -a "ppc i386" --vcs-info
+MAKE_SYM_STORE_ARGS := -c -a "ppc i386" --vcs-info
 MAKE_SYM_STORE_PATH := $(DIST)/universal
 else
-MAKE_SYM_STORE_ARGS := -a $(OS_TEST) --vcs-info
+MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
 MAKE_SYM_STORE_PATH := $(DIST)/bin
 endif
 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
 endif
 ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
-MAKE_SYM_STORE_ARGS := --vcs-info
+MAKE_SYM_STORE_ARGS := -c --vcs-info
 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
 MAKE_SYM_STORE_PATH := $(DIST)/bin
 endif
 
 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
 
 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -703,20 +703,37 @@ class Dumper_Mac(Dumper):
         down to the superclass method instead."""
         dsymbundle = file + ".dSYM"
         if os.path.exists(dsymbundle):
             shutil.rmtree(dsymbundle)
         # dsymutil takes --arch=foo instead of -a foo like everything else
         os.system("dsymutil %s %s >/dev/null" % (' '.join([a.replace('-a ', '--arch=') for a in self.archs]),
                                       file))
         res = Dumper.ProcessFile(self, dsymbundle)
-        if not self.copy_debug:
-            shutil.rmtree(dsymbundle)
+        # CopyDebug will already have been run from Dumper.ProcessFile
+        shutil.rmtree(dsymbundle)
         return res
 
+    def CopyDebug(self, file, debug_file, guid):
+        """ProcessFile has already produced a dSYM bundle, so we should just
+        copy that to the destination directory. However, we'll package it
+        into a .tar.bz2 because the debug symbols are pretty huge, and
+        also because it's a bundle, so it's a directory. |file| here is the
+        dSYM bundle, and |debug_file| is the original filename."""
+        rel_path = os.path.join(debug_file,
+                                guid,
+                                os.path.basename(file) + ".tar.bz2")
+        full_path = os.path.abspath(os.path.join(self.symbol_path,
+                                                  rel_path))
+        success = call(["tar", "cjf", full_path, os.path.basename(file)],
+                       cwd=os.path.dirname(file),
+                       stdout=open("/dev/null","w"), stderr=STDOUT)
+        if success == 0 and os.path.exists(full_path):
+            print rel_path
+
 # Entry point if called as a standalone program
 def main():
     parser = OptionParser(usage="usage: %prog [options] <dump_syms binary> <symbol store path> <debug info files>")
     parser.add_option("-c", "--copy",
                       action="store_true", dest="copy_debug", default=False,
                       help="Copy debug info files into the same directory structure as symbol files")
     parser.add_option("-a", "--archs",
                       action="store", dest="archs",