[mq]: M-autoinjector-linuxonly
authorSteve Fink <sfink@mozilla.com>
Mon, 15 Jun 2015 15:55:06 -0700
changeset 488740 5e40d37f4b2b4e46290926018ef839b786cecfb2
parent 487393 c777ea257d6b7ee9eb2e8ac0863f83ca06178eac
child 488741 e9d4e2670503cf185462f2e09958a42e278b9268
push id74435
push usersfink@mozilla.com
push dateMon, 15 Jun 2015 23:01:03 +0000
treeherdertry@e9d4e2670503 [default view] [failures only]
milestone41.0a1
[mq]: M-autoinjector-linuxonly
Makefile.in
aclocal.m4
build/autoconf/crashreporter.m4
configure.in
js/src/aclocal.m4
js/src/configure.in
js/src/devtools/automation/autospider.sh
testing/mozbase/mozcrash/mozcrash/mozcrash.py
toolkit/crashreporter/tools/symbolstore.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -210,17 +210,16 @@ ifeq (,$(filter-out Linux SunOS,$(OS_ARC
 MAKE_SYM_STORE_ARGS := -c --vcs-info
 DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
 MAKE_SYM_STORE_PATH := $(DIST)/bin
 endif
 MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist_include,$(DIST)/include
 
 SYM_STORE_SOURCE_DIRS := $(topsrcdir)
 
-ifndef JS_STANDALONE
 include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
 ifdef MOZ_SYMBOLS_EXTRA_BUILDID
 EXTRA_BUILDID := -$(MOZ_SYMBOLS_EXTRA_BUILDID)
 endif
 
 SYMBOL_INDEX_NAME = \
   $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)$(EXTRA_BUILDID)-symbols.txt
@@ -253,17 +252,16 @@ endif # MOZ_CRASHREPORTER
 
 uploadsymbols:
 ifdef MOZ_CRASHREPORTER
 ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
 	$(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
 else
 	$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
 endif
-endif
 
 # MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
 # exporting it makes make run its $(shell) command for each invoked submake,
 # so transform it to an immediate assignment.
 MOZ_SOURCE_STAMP := $(MOZ_SOURCE_STAMP)
 export MOZ_SOURCE_STAMP
 endif
 
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -29,16 +29,17 @@ builtin(include, build/autoconf/android.
 builtin(include, build/autoconf/zlib.m4)dnl
 builtin(include, build/autoconf/linux.m4)dnl
 builtin(include, build/autoconf/python-virtualenv.m4)dnl
 builtin(include, build/autoconf/winsdk.m4)dnl
 builtin(include, build/autoconf/icu.m4)dnl
 builtin(include, build/autoconf/ffi.m4)dnl
 builtin(include, build/autoconf/clang-plugin.m4)dnl
 builtin(include, build/autoconf/alloc.m4)dnl
+builtin(include, build/autoconf/crashreporter.m4)dnl
 
 MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
 # configure.in: autoconf puts the argument parsing code above anything
 # expanded from configure.in, and we need to get the configure options
 # from .mozconfig in place before that argument parsing code.
 MOZ_READ_MOZCONFIG(.)
new file mode 100644
--- /dev/null
+++ b/build/autoconf/crashreporter.m4
@@ -0,0 +1,70 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+AC_DEFUN([MOZ_CONFIG_CRASHREPORTER], [
+
+case $target in
+i?86-*-mingw*|x86_64-*-mingw*)
+  MOZ_CRASHREPORTER=1
+  ;;
+i?86-apple-darwin*|x86_64-apple-darwin*)
+  MOZ_CRASHREPORTER=1
+  ;;
+i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
+  if test "$MOZ_ENABLE_GTK" || test "$JS_STANDALONE"; then
+    MOZ_CRASHREPORTER=1
+  fi
+  ;;
+*-android*|*-linuxandroid*)
+  MOZ_CRASHREPORTER=1
+  ;;
+*solaris*)
+  MOZ_CRASHREPORTER=1
+  ;;
+esac
+
+MOZ_ARG_DISABLE_BOOL(crashreporter,
+[  --disable-crashreporter Disable breakpad crash reporting],
+    [MOZ_CRASHREPORTER=],
+    [MOZ_CRASHREPORTER=F # Force enable breakpad])
+
+if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
+  if test "$MOZ_CRASHREPORTER" = F; then
+    AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
+  fi
+  MOZ_CRASHREPORTER=
+fi
+
+if test -n "$MOZ_CRASHREPORTER"; then
+   AC_DEFINE(MOZ_CRASHREPORTER)
+
+  if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
+    test -z "$SKIP_LIBRARY_CHECKS"; then
+    PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
+  fi
+
+  if test "$OS_ARCH" = "WINNT"; then
+    if test -z "$HAVE_64BIT_BUILD"; then
+      MOZ_CRASHREPORTER_INJECTOR=1
+      AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
+    fi
+  fi
+fi
+
+MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
+[  --with-crashreporter-enable-percent=NN
+                          Enable sending crash reports by default on NN% of users. (default=100)],
+[ val=`echo $withval | sed 's/[^0-9]//g'`
+    MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
+
+if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
+   MOZ_CRASHREPORTER_ENABLE_PERCENT=100
+fi
+AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
+
+AC_SUBST(MOZ_CRASHREPORTER)
+AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
+AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
+
+])
--- a/configure.in
+++ b/configure.in
@@ -6069,74 +6069,17 @@ if test "$MOZ_GAMEPAD"; then
 fi
 AC_SUBST(MOZ_GAMEPAD)
 AC_SUBST(MOZ_GAMEPAD_BACKEND)
 
 dnl ========================================================
 dnl = Breakpad crash reporting (on by default on supported platforms)
 dnl ========================================================
 
-case $target in
-i?86-*-mingw*|x86_64-*-mingw*)
-  MOZ_CRASHREPORTER=1
-  ;;
-i?86-apple-darwin*|x86_64-apple-darwin*)
-  MOZ_CRASHREPORTER=1
-  ;;
-i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
-  if test "$MOZ_ENABLE_GTK"; then
-    MOZ_CRASHREPORTER=1
-  fi
-  ;;
-*-android*|*-linuxandroid*)
-  MOZ_CRASHREPORTER=1
-  ;;
-*solaris*)
-  MOZ_CRASHREPORTER=1
-  ;;
-esac
-
-MOZ_ARG_DISABLE_BOOL(crashreporter,
-[  --disable-crashreporter Disable breakpad crash reporting],
-    [MOZ_CRASHREPORTER=],
-    [MOZ_CRASHREPORTER=F # Force enable breakpad])
-
-if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
-  if test "$MOZ_CRASHREPORTER" = F; then
-    AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
-  fi
-  MOZ_CRASHREPORTER=
-fi
-
-if test -n "$MOZ_CRASHREPORTER"; then
-   AC_DEFINE(MOZ_CRASHREPORTER)
-
-  if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
-    test -z "$SKIP_LIBRARY_CHECKS"; then
-    PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
-  fi
-
-  if test "$OS_ARCH" = "WINNT"; then
-    if test -z "$HAVE_64BIT_BUILD"; then
-      MOZ_CRASHREPORTER_INJECTOR=1
-      AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
-    fi
-  fi
-fi
-
-MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
-[  --with-crashreporter-enable-percent=NN
-                          Enable sending crash reports by default on NN% of users. (default=100)],
-[ val=`echo $withval | sed 's/[^0-9]//g'`
-    MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
-
-if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
-   MOZ_CRASHREPORTER_ENABLE_PERCENT=100
-fi
-AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
+MOZ_CONFIG_CRASHREPORTER
 
 dnl ========================================================
 dnl = libjpeg-turbo configuration
 dnl ========================================================
 MOZ_LIBJPEG_TURBO=
 if test -z "$MOZ_NATIVE_JPEG"; then
     MOZ_LIBJPEG_TURBO=1
 fi
@@ -8508,19 +8451,16 @@ AC_SUBST(KEYTOOL)
 AC_SUBST(MOZ_PROFILELOCKING)
 
 AC_SUBST(ENABLE_TESTS)
 AC_SUBST(MOZ_UNIVERSALCHARDET)
 AC_SUBST(ACCESSIBILITY)
 AC_SUBST(MOZ_SPELLCHECK)
 AC_SUBST(MOZ_ANDROID_APZ)
 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
-AC_SUBST(MOZ_CRASHREPORTER)
-AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
-AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
 AC_SUBST(MOZ_STUB_INSTALLER)
 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
 AC_SUBST(MOZ_ENABLE_SIGNMAR)
 AC_SUBST(MOZ_UPDATER)
 
 AC_SUBST(MOZ_ANGLE_RENDERER)
 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -28,16 +28,17 @@ builtin(include, ../../build/autoconf/an
 builtin(include, ../../build/autoconf/zlib.m4)dnl
 builtin(include, ../../build/autoconf/linux.m4)dnl
 builtin(include, ../../build/autoconf/python-virtualenv.m4)dnl
 builtin(include, ../../build/autoconf/winsdk.m4)dnl
 builtin(include, ../../build/autoconf/icu.m4)dnl
 builtin(include, ../../build/autoconf/ffi.m4)dnl
 builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
 builtin(include, ../../build/autoconf/alloc.m4)dnl
+builtin(include, ../../build/autoconf/crashreporter.m4)dnl
 
 define([__MOZ_AC_INIT_PREPARE], defn([AC_INIT_PREPARE]))
 define([AC_INIT_PREPARE],
 [if test -z "$srcdir"; then
   srcdir=`dirname "[$]0"`
 fi
 srcdir="$srcdir/../.."
 __MOZ_AC_INIT_PREPARE($1)
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2958,16 +2958,23 @@ if test "$MOZ_DMD"; then
 
     if test "${CPU_ARCH}" = "arm"; then
         CFLAGS="$CFLAGS -funwind-tables"
         CXXFLAGS="$CXXFLAGS -funwind-tables"
     fi
 fi
 
 dnl ========================================================
+dnl = Breakpad crash reporting (on by default on supported platforms)
+dnl ========================================================
+
+AC_PATH_PROG(OBJCOPY,objcopy)
+MOZ_CONFIG_CRASHREPORTER
+
+dnl ========================================================
 dnl = Enable jemalloc
 dnl ========================================================
 
 LOCAL_MOZ_MEMORY=1
 MOZ_ARG_DISABLE_BOOL(jemalloc,
 [  --disable-jemalloc       Don't replace memory allocator with jemalloc],
     LOCAL_MOZ_MEMORY=)
 
--- a/js/src/devtools/automation/autospider.sh
+++ b/js/src/devtools/automation/autospider.sh
@@ -164,39 +164,61 @@ cp -p $SOURCE/build/unix/run-mozilla.sh 
 COMMAND_PREFIX=''
 
 # On Linux, disable ASLR to make shell builds a bit more reproducible.
 if type setarch >/dev/null 2>&1; then
     COMMAND_PREFIX="setarch $(uname -m) -R "
 fi
 
 if [ "$OSTYPE" = "linux-gnu" ]; then
-    # Build the breakpad injector shared lib
+    # Build the breakpad injector shared lib and the breakpad symbol dumper
+    INJECT_OBJDIR="$OBJDIR/obj-inject"
+
     pushd "$SOURCE"
     TOP_OBJDIR="$OBJDIR" MOZCONFIG="$SOURCE/js/src/devtools/automation/mozconfig.inject" ./mach configure
-    TOP_OBJDIR="$OBJDIR" MOZCONFIG="$SOURCE/js/src/devtools/automation/mozconfig.inject" ./mach build -C . export toolkit/crashreporter/injector/target
-    COMMAND_PREFIX="env LD_PRELOAD=$OBJDIR/obj-inject/dist/bin/libbreakpadinjector.so $COMMAND_PREFIX"
+    TOP_OBJDIR="$OBJDIR" MOZCONFIG="$SOURCE/js/src/devtools/automation/mozconfig.inject" ./mach build export
+    pushd "$INJECT_OBJDIR"
+    make toolkit/crashreporter/injector/target
+    make toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/host
+    cp dist/host/bin/dump_syms ../dist/host/bin/dump_syms
+
+    # Convert symbols to breakpad format
+    cd "$OBJDIR"
+    SRCSRV_ROOT="file://$SOURCE" make buildsymbols
+    popd
+    
+    # Set up later commands to run with the breakpad injector LD_PRELOADed
+    COMMAND_PREFIX="env LD_PRELOAD=$INJECT_OBJDIR/dist/bin/libbreakpadinjector.so $COMMAND_PREFIX"
     popd
 fi
 
 RUN_JSTESTS=true
 
 PARENT=$$
 
 # Spawn off a child process, detached from any of our fds, that will kill us after a timeout.
 # To report the timeout, catch the signal in the parent before exiting.
 sh -c "sleep $TIMEOUT; kill -INT $PARENT" <&- >&- 2>&- &
 KILLER=$!
 disown %1
 set +x
 trap "echo 'TEST-UNEXPECTED-FAIL | autospider.sh $TIMEOUT timeout | ignore later failures' >&2; exit 1" INT
 set -x
 
-# If we do *not* hit that timeout, kill off the spawned process on a regular exit.
-trap "kill $KILLER" EXIT
+function onexit() {
+    # If we do *not* hit that timeout, kill off the spawned process on a regular exit.
+    kill $KILLER
+    if [[ -n "$INJECT_OBJDIR" ]]; then
+        MINIDUMP_STACKWALK="${MINIDUMP_STACKWALK:-$SOURCE/../scripts/breakpad/linux64/minidump_stackwalk}"
+        # TODO: need to figure out how to get symbols
+        "$INJECT_OBJDIR/_virtualenv/bin/python" "$SOURCE/testing/mozbase/mozcrash/mozcrash/mozcrash.py" "${TMPDIR:-/tmp}" "$OBJDIR/dist/crashreporter-symbols" -b "$MINIDUMP_STACKWALK"
+    fi
+}
+
+trap onexit EXIT
 
 if [[ "$VARIANT" = "rootanalysis" ]]; then
     export JS_GC_ZEAL=7
 
 elif [[ "$VARIANT" = "compacting" ]]; then
     export JS_GC_ZEAL=14
 
     # Ignore timeouts from tests that are known to take too long with this zeal mode
--- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py
+++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py
@@ -334,8 +334,25 @@ def check_for_java_exception(logcat, qui
                     exception_location = m.group(1)
                 if not quiet:
                     print "PROCESS-CRASH | java-exception | %s %s" % (exception_type, exception_location)
             else:
                 print "Automation Error: java exception in logcat at line %d of %d: %s" % (i, len(logcat), line)
             break
 
     return found_exception
+
+if __name__ == '__main__':
+    import argparse
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--stackwalk-binary', '-b')
+    parser.add_argument('--dump-save-path', '-o')
+    parser.add_argument('--test-name', '-n')
+    parser.add_argument('--quiet', '-q')
+    parser.add_argument('dump_directory')
+    parser.add_argument('symbols_path')
+    args = parser.parse_args()
+
+    check_for_crashes(args.dump_directory, args.symbols_path,
+                      stackwalk_binary=args.stackwalk_binary,
+                      dump_save_path=args.dump_save_path,
+                      test_name=args.test_name,
+                      quiet=args.quiet)
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -609,16 +609,17 @@ 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:
+                self.output_pid(sys.stderr, [self.dump_syms] + arch.split() + [file])
                 proc = subprocess.Popen([self.dump_syms] + arch.split() + [file],
                                         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"