From 429f53c829814a4856e19672a2cc9a7b3e5f8520 Mon Sep 17 00:00:00 2001 From: "alfred.peng@sun.com" Date: Wed, 19 Mar 2008 18:13:36 -0700 Subject: [PATCH] Bug 391361. The integration of breakpad on Solaris. r=ted.mielczarek,a=beltzner. --- Makefile.in | 2 +- configure.in | 5 +- toolkit/crashreporter/Makefile.in | 12 ++++ toolkit/crashreporter/client/Makefile.in | 14 +++- .../src/client/solaris/handler/Makefile.in | 60 ++++++++++++++++ .../src/common/linux/Makefile.in | 2 - .../src/common/solaris/Makefile.in | 68 +++++++++++++++++++ .../src/tools/solaris/dump_syms/Makefile.in | 66 ++++++++++++++++++ toolkit/crashreporter/nsExceptionHandler.cpp | 9 +-- toolkit/crashreporter/test/Makefile.in | 9 +++ toolkit/crashreporter/tools/symbolstore.py | 24 +++++++ toolkit/library/Makefile.in | 4 ++ toolkit/xre/Makefile.in | 9 +++ 13 files changed, 274 insertions(+), 10 deletions(-) create mode 100644 toolkit/crashreporter/google-breakpad/src/client/solaris/handler/Makefile.in create mode 100644 toolkit/crashreporter/google-breakpad/src/common/solaris/Makefile.in create mode 100644 toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/Makefile.in diff --git a/Makefile.in b/Makefile.in index 83fc06663e7..b9375f469c1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -162,7 +162,7 @@ MAKE_SYM_STORE_PATH := $(DIST)/bin endif DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms endif -ifeq ($(OS_ARCH),Linux) +ifeq (,$(filter-out Linux SunOS,$(OS_ARCH))) MAKE_SYM_STORE_ARGS := --vcs-info DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms MAKE_SYM_STORE_PATH := $(DIST)/bin diff --git a/configure.in b/configure.in index 1d89a5f0d11..a0aef2f71b0 100644 --- a/configure.in +++ b/configure.in @@ -5362,7 +5362,8 @@ dnl ======================================================== if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \ || test "$OS_ARCH" = "Darwin" \ - || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86") \ + || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \ + || test "$OS_ARCH" = "SunOS") \ && test -z "$HAVE_64BIT_OS"; then MOZ_CRASHREPORTER=1 fi @@ -5375,7 +5376,7 @@ MOZ_ARG_DISABLE_BOOL(crashreporter, if test -n "$MOZ_CRASHREPORTER"; then AC_DEFINE(MOZ_CRASHREPORTER) - if test "$OS_ARCH" = "Linux" && \ + if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \ test -z "$SKIP_LIBRARY_CHECKS"; then PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0) AC_SUBST(MOZ_GTHREAD_CFLAGS) diff --git a/toolkit/crashreporter/Makefile.in b/toolkit/crashreporter/Makefile.in index 0483ecad072..4365d9bd97a 100644 --- a/toolkit/crashreporter/Makefile.in +++ b/toolkit/crashreporter/Makefile.in @@ -83,6 +83,18 @@ DIRS += \ $(NULL) endif +ifeq ($(OS_ARCH),SunOS) +# there's no define for this normally +DEFINES += -DXP_SOLARIS +DIRS += \ + google-breakpad/src/common \ + google-breakpad/src/common/solaris \ + google-breakpad/src/client \ + google-breakpad/src/client/solaris/handler \ + google-breakpad/src/tools/solaris/dump_syms \ + $(NULL) +endif + DIRS += client LOCAL_INCLUDES = -I$(srcdir)/google-breakpad/src diff --git a/toolkit/crashreporter/client/Makefile.in b/toolkit/crashreporter/client/Makefile.in index eaa4f14057f..211692e8ae9 100644 --- a/toolkit/crashreporter/client/Makefile.in +++ b/toolkit/crashreporter/client/Makefile.in @@ -89,6 +89,18 @@ CPPSRCS += http_upload.cc FORCE_USE_PIC=1 endif +ifeq ($(OS_ARCH),SunOS) +CPPSRCS += crashreporter_linux.cpp +LIBS += \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \ + $(NULL) +LOCAL_INCLUDES += -I$(srcdir) +OS_CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_GTHREAD_CFLAGS) +OS_LIBS += $(MOZ_GTK2_LIBS) $(MOZ_GTHREAD_LIBS) +CPPSRCS += http_upload.cc +FORCE_USE_PIC=1 +endif + include $(topsrcdir)/config/rules.mk ifeq ($(OS_ARCH),Darwin) @@ -102,7 +114,7 @@ libs:: rm -f $(DIST)/bin/crashreporter endif -ifeq ($(OS_ARCH),Linux) +ifeq (,$(filter-out Linux SunOS,$(OS_ARCH))) export:: $(srcdir)/../google-breakpad/src/common/linux/http_upload.cc $(INSTALL) $^ . diff --git a/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/Makefile.in b/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/Makefile.in new file mode 100644 index 00000000000..87300becb30 --- /dev/null +++ b/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/Makefile.in @@ -0,0 +1,60 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Mozilla Breakpad integration +# +# The Initial Developer of the Original Code is +# Alfred Peng +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = handler +LIBRARY_NAME = exception_handler_s +XPI_NAME = crashreporter + +LOCAL_INCLUDES = -I$(srcdir)/../../.. + +CPPSRCS = \ + exception_handler.cc \ + minidump_generator.cc \ + solaris_lwp.cc \ + $(NULL) + +# need static lib +FORCE_STATIC_LIB = 1 +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/rules.mk diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in index 33079e04049..942e1ada45c 100644 --- a/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in +++ b/toolkit/crashreporter/google-breakpad/src/common/linux/Makefile.in @@ -47,8 +47,6 @@ HOST_LIBRARY_NAME = host_breakpad_linux_common_s LOCAL_INCLUDES = -I$(srcdir)/../.. -CXXFLAGS := $(filter-out -pedantic,$(CXXFLAGS)) - # not compiling http_upload.cc currently # since it depends on libcurl CPPSRCS = \ diff --git a/toolkit/crashreporter/google-breakpad/src/common/solaris/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/solaris/Makefile.in new file mode 100644 index 00000000000..60e1ecf0e7c --- /dev/null +++ b/toolkit/crashreporter/google-breakpad/src/common/solaris/Makefile.in @@ -0,0 +1,68 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Mozilla Breakpad integration +# +# The Initial Developer of the Original Code is +# Alfred Peng +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = breakpad_solaris_common +LIBRARY_NAME = breakpad_solaris_common_s +HOST_LIBRARY_NAME = host_breakpad_solaris_common_s + +LOCAL_INCLUDES = -I$(srcdir)/../.. + +# not compiling http_upload.cc currently +# since it depends on libcurl +CPPSRCS = \ + dump_symbols.cc \ + file_id.cc \ + guid_creator.cc \ + $(NULL) + +HOST_CPPSRCS = \ + dump_symbols.cc \ + file_id.cc \ + guid_creator.cc \ + $(NULL) + +# need static lib +FORCE_STATIC_LIB = 1 +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/rules.mk diff --git a/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/Makefile.in b/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/Makefile.in new file mode 100644 index 00000000000..10ede329067 --- /dev/null +++ b/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/Makefile.in @@ -0,0 +1,66 @@ +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Mozilla Breakpad integration +# +# The Initial Developer of the Original Code is +# Alfred Peng +# Portions created by the Initial Developer are Copyright (C) 2007 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +HOST_PROGRAM = dump_syms + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../.. \ + -I$(srcdir)/../../../common/solaris \ + $(NULL) + +HOST_CPPSRCS = \ + dump_syms.cc \ + $(NULL) + +HOST_LIBS += \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)host_breakpad_solaris_common_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)host_breakpad_common_s.$(LIB_SUFFIX) \ + $(NULL) + +HOST_LDFLAGS += -lelf -ldemangle + +# force C++ linking +CPP_PROG_LINK = 1 +FORCE_USE_PIC = 1 + +include $(topsrcdir)/config/rules.mk diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index c8faf7a2991..8312f7d1f81 100755 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -57,14 +57,15 @@ #include #include #include +#elif defined(XP_SOLARIS) +#include "client/solaris/handler/exception_handler.h" +#include +#include +#include #else #error "Not yet implemented for this platform" #endif // defined(XP_WIN32) -#ifndef HAVE_CPP_2BYTE_WCHAR_T -#error "This code expects a 2 byte wchar_t. You should --disable-crashreporter." -#endif - #include #include #include diff --git a/toolkit/crashreporter/test/Makefile.in b/toolkit/crashreporter/test/Makefile.in index 73a5d13c4bc..21d071f3c59 100644 --- a/toolkit/crashreporter/test/Makefile.in +++ b/toolkit/crashreporter/test/Makefile.in @@ -94,6 +94,15 @@ LIBS += \ $(NULL) endif +ifeq ($(OS_ARCH),SunOS) +LIBS += \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ + $(NULL) +endif + ifndef MOZ_ENABLE_LIBXUL check:: $(PROGRAM) $(RUN_TEST_PROGRAM) $(DIST)/bin/TestCrashReporterAPI diff --git a/toolkit/crashreporter/tools/symbolstore.py b/toolkit/crashreporter/tools/symbolstore.py index 6559978b261..24747f5dbe3 100755 --- a/toolkit/crashreporter/tools/symbolstore.py +++ b/toolkit/crashreporter/tools/symbolstore.py @@ -278,6 +278,7 @@ def GetPlatformSpecificDumper(**kwargs): return {'win32': Dumper_Win32, 'cygwin': Dumper_Win32, 'linux2': Dumper_Linux, + 'sunos5': Dumper_Solaris, 'darwin': Dumper_Mac}[sys.platform](**kwargs) def SourceIndex(fileStream, outputPath): @@ -402,6 +403,11 @@ class Dumper: if line.startswith("FILE"): # FILE index filename (x, index, filename) = line.split(None, 2) + if sys.platform == "sunos5": + start = filename.find(self.srcdir) + if start == -1: + start = 0 + filename = filename[start:] filename = self.FixFilenameCase(filename.rstrip()) sourcepath = filename if self.vcsinfo: @@ -528,6 +534,24 @@ class Dumper_Linux(Dumper): os.system("gzip %s" % full_path) print rel_path + ".gz" +class Dumper_Solaris(Dumper): + def RunFileCommand(self, file): + """Utility function, returns the output of file(1)""" + try: + output = os.popen("file " + file).read() + return output.split('\t')[1]; + except: + return "" + + def ShouldProcess(self, file): + """This function will allow processing of files that are + executable, or end with the .so extension, and additionally + file(1) reports as being ELF files. It expects to find the file + command in PATH.""" + if file.endswith(".so") or os.access(file, os.X_OK): + return self.RunFileCommand(file).startswith("ELF") + return False + class Dumper_Mac(Dumper): def ShouldProcess(self, file): """This function will allow processing of files that are diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 8f98a086ed8..3d3b4040ee8 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -226,6 +226,10 @@ ifeq ($(OS_ARCH),BeOS) EXTRA_DSO_LDOPTS += -lbe -ltracker endif +ifeq ($(OS_ARCH),SunOS) +EXTRA_DSO_LDOPTS += -lelf -ldemangle -lCstd +endif + ifeq ($(OS_ARCH),WINNT) EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32) ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in index 11a22d56bdd..7a631814e9b 100644 --- a/toolkit/xre/Makefile.in +++ b/toolkit/xre/Makefile.in @@ -203,6 +203,15 @@ SHARED_LIBRARY_LIBS += \ $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \ $(NULL) endif + +ifeq ($(OS_ARCH),SunOS) +SHARED_LIBRARY_LIBS += \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/solaris/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \ + $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/solaris/$(LIB_PREFIX)breakpad_solaris_common_s.$(LIB_SUFFIX) \ + $(NULL) +endif endif include $(topsrcdir)/config/rules.mk