Bug 623183 - Build dump_syms on Windows when using VS2015; r=ted
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 08 Mar 2016 14:07:28 -0800
changeset 287387 43092fb2943cfd1dad71b9ee47775c5953bc637e
parent 287386 64419b8e1f04592ed61f48d7b35c69160a941445
child 287388 32ce2dbc3b8fd77254da43a829932d6ba8b9013e
push id18088
push usercbook@mozilla.com
push dateWed, 09 Mar 2016 10:48:42 +0000
treeherderfx-team@7436297ba12f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs623183
milestone47.0a1
Bug 623183 - Build dump_syms on Windows when using VS2015; r=ted MozReview-Commit-ID: LCvipO5FXdR
Makefile.in
old-configure.in
toolkit/crashreporter/google-breakpad/src/tools/windows/dump_syms/moz.build
toolkit/crashreporter/moz.build
toolkit/crashreporter/tools/unit-symbolstore.py
--- a/Makefile.in
+++ b/Makefile.in
@@ -244,17 +244,21 @@ distclean::
 	$(RM) $(DIST_GARBAGE)
 
 ifeq ($(OS_ARCH),WINNT)
 # we want to copy PDB files on Windows
 MAKE_SYM_STORE_ARGS := -c --vcs-info
 ifdef PDBSTR_PATH
 MAKE_SYM_STORE_ARGS += -i
 endif
+ifdef MSVC_HAS_DIA_SDK
+DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms.exe
+else
 DUMP_SYMS_BIN ?= $(topsrcdir)/toolkit/crashreporter/tools/win32/dump_syms_vc$(_MSC_VER).exe
+endif
 # 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 := -c -a 'i386 x86_64' --vcs-info
 MAKE_SYM_STORE_PATH := $(DIST)/universal
--- a/old-configure.in
+++ b/old-configure.in
@@ -470,16 +470,19 @@ case "$target" in
             MSVC_C_RUNTIME_DLL=msvcr120.dll
             MSVC_CXX_RUNTIME_DLL=msvcp120.dll
         elif test "$_CC_MAJOR_VERSION" = "19" -a "$_CC_BUILD_VERSION" -ge "23506"; then
             _CC_SUITE=14
             MSVS_VERSION=2015
             MSVC_C_RUNTIME_DLL=vcruntime140.dll
             MSVC_CXX_RUNTIME_DLL=msvcp140.dll
 
+            MSVC_HAS_DIA_SDK=1
+            AC_DEFINE(MSVC_HAS_DIA_SDK)
+
             # -Wv:18 disables all warnings introduced after VS2013
             # See http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx
             CFLAGS="$CFLAGS -Wv:18"
             CXXFLAGS="$CXXFLAGS -Wv:18"
 
             # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
             CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
 
@@ -500,16 +503,17 @@ case "$target" in
               WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd`
             fi
         else
             AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
 You must install Visual C++ 2013 Update 3, Visual C++ 2015 Update 1, or newer in order to build.
 See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
         fi
         AC_SUBST(MSVS_VERSION)
+        AC_SUBST(MSVC_HAS_DIA_SDK)
         AC_SUBST(MSVC_C_RUNTIME_DLL)
         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
 
         AC_DEFINE(HAVE_SEH_EXCEPTIONS)
 
         if test -n "$WIN32_REDIST_DIR"; then
           if test ! -d "$WIN32_REDIST_DIR"; then
             AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
new file mode 100644
--- /dev/null
+++ b/toolkit/crashreporter/google-breakpad/src/tools/windows/dump_syms/moz.build
@@ -0,0 +1,31 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+HostProgram('dump_syms')
+
+HOST_SOURCES += [
+    '../../../common/windows/dia_util.cc',
+    '../../../common/windows/guid_string.cc',
+    '../../../common/windows/omap.cc',
+    '../../../common/windows/pdb_source_line_writer.cc',
+    '../../../common/windows/string_utils.cc',
+    'dump_syms.cc',
+]
+
+HOST_CXXFLAGS += [
+    '-O2',
+    '-EHsc',
+    '-MD'
+]
+
+HOST_OS_LIBS += [
+    'diaguids',
+    'imagehlp'
+]
+
+LOCAL_INCLUDES += [
+    '../../..'
+]
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -3,20 +3,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SPHINX_TREES['crashreporter'] = 'docs'
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += [
-    'google-breakpad/src/common',
-    'breakpad-windows-libxul'
+        'google-breakpad/src/common',
+        'breakpad-windows-libxul',
     ]
 
+    if CONFIG['MSVC_HAS_DIA_SDK']:
+        DIRS += ['google-breakpad/src/tools/windows/dump_syms']
+
     if CONFIG['MOZ_CRASHREPORTER_INJECTOR']:
         DIRS += ['breakpad-windows-standalone']
 
 elif CONFIG['OS_ARCH'] == 'Darwin':
     DIRS += [
         'google-breakpad/src/common',
         'google-breakpad/src/common/mac',
         'google-breakpad/src/client',
--- a/toolkit/crashreporter/tools/unit-symbolstore.py
+++ b/toolkit/crashreporter/tools/unit-symbolstore.py
@@ -473,22 +473,27 @@ class TestFunctional(HelperMixin, unitte
         self.skip_test = False
         if buildconfig.substs['MOZ_BUILD_APP'] != 'browser':
             self.skip_test = True
         self.topsrcdir = buildconfig.topsrcdir
         self.script_path = os.path.join(self.topsrcdir, 'toolkit',
                                         'crashreporter', 'tools',
                                         'symbolstore.py')
         if platform.system() in ("Windows", "Microsoft"):
-            self.dump_syms = os.path.join(self.topsrcdir,
-                                          'toolkit',
-                                          'crashreporter',
-                                          'tools',
-                                          'win32',
-                                          'dump_syms_vc{_MSC_VER}.exe'.format(**buildconfig.substs))
+            if buildconfig.substs['MSVC_HAS_DIA_SDK']:
+                self.dump_syms = os.path.join(buildconfig.topobjdir,
+                                              'dist', 'host', 'bin',
+                                              'dump_syms.exe')
+            else:
+                self.dump_syms = os.path.join(self.topsrcdir,
+                                              'toolkit',
+                                              'crashreporter',
+                                              'tools',
+                                              'win32',
+                                              'dump_syms_vc{_MSC_VER}.exe'.format(**buildconfig.substs))
             self.target_bin = os.path.join(buildconfig.topobjdir,
                                            'browser',
                                            'app',
                                            'firefox.pdb')
         else:
             self.dump_syms = os.path.join(buildconfig.topobjdir,
                                           'dist', 'host', 'bin',
                                           'dump_syms')