Bug 391361. The integration of breakpad on Solaris. r=ted.mielczarek,a=beltzner.

This commit is contained in:
alfred.peng@sun.com 2008-03-19 18:13:36 -07:00
parent 59f147fb94
commit 429f53c829
13 changed files with 274 additions and 10 deletions

View File

@ -162,7 +162,7 @@ MAKE_SYM_STORE_PATH := $(DIST)/bin
endif endif
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
endif endif
ifeq ($(OS_ARCH),Linux) ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
MAKE_SYM_STORE_ARGS := --vcs-info MAKE_SYM_STORE_ARGS := --vcs-info
DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms DUMP_SYMS_BIN ?= $(DIST)/host/bin/dump_syms
MAKE_SYM_STORE_PATH := $(DIST)/bin MAKE_SYM_STORE_PATH := $(DIST)/bin

View File

@ -5362,7 +5362,8 @@ dnl ========================================================
if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \ if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
|| test "$OS_ARCH" = "Darwin" \ || 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 && test -z "$HAVE_64BIT_OS"; then
MOZ_CRASHREPORTER=1 MOZ_CRASHREPORTER=1
fi fi
@ -5375,7 +5376,7 @@ MOZ_ARG_DISABLE_BOOL(crashreporter,
if test -n "$MOZ_CRASHREPORTER"; then if test -n "$MOZ_CRASHREPORTER"; then
AC_DEFINE(MOZ_CRASHREPORTER) AC_DEFINE(MOZ_CRASHREPORTER)
if test "$OS_ARCH" = "Linux" && \ if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
test -z "$SKIP_LIBRARY_CHECKS"; then test -z "$SKIP_LIBRARY_CHECKS"; then
PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0) PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
AC_SUBST(MOZ_GTHREAD_CFLAGS) AC_SUBST(MOZ_GTHREAD_CFLAGS)

View File

@ -83,6 +83,18 @@ DIRS += \
$(NULL) $(NULL)
endif 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 DIRS += client
LOCAL_INCLUDES = -I$(srcdir)/google-breakpad/src LOCAL_INCLUDES = -I$(srcdir)/google-breakpad/src

View File

@ -89,6 +89,18 @@ CPPSRCS += http_upload.cc
FORCE_USE_PIC=1 FORCE_USE_PIC=1
endif 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 include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Darwin) ifeq ($(OS_ARCH),Darwin)
@ -102,7 +114,7 @@ libs::
rm -f $(DIST)/bin/crashreporter rm -f $(DIST)/bin/crashreporter
endif endif
ifeq ($(OS_ARCH),Linux) ifeq (,$(filter-out Linux SunOS,$(OS_ARCH)))
export:: $(srcdir)/../google-breakpad/src/common/linux/http_upload.cc export:: $(srcdir)/../google-breakpad/src/common/linux/http_upload.cc
$(INSTALL) $^ . $(INSTALL) $^ .

View File

@ -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 <alfred.peng@sun.com>
# 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

View File

@ -47,8 +47,6 @@ HOST_LIBRARY_NAME = host_breakpad_linux_common_s
LOCAL_INCLUDES = -I$(srcdir)/../.. LOCAL_INCLUDES = -I$(srcdir)/../..
CXXFLAGS := $(filter-out -pedantic,$(CXXFLAGS))
# not compiling http_upload.cc currently # not compiling http_upload.cc currently
# since it depends on libcurl # since it depends on libcurl
CPPSRCS = \ CPPSRCS = \

View File

@ -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 <alfred.peng@sun.com>
# 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

View File

@ -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 <alfred.peng@sun.com>
# 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

View File

@ -57,14 +57,15 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#elif defined(XP_SOLARIS)
#include "client/solaris/handler/exception_handler.h"
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#else #else
#error "Not yet implemented for this platform" #error "Not yet implemented for this platform"
#endif // defined(XP_WIN32) #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 <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <prenv.h> #include <prenv.h>

View File

@ -94,6 +94,15 @@ LIBS += \
$(NULL) $(NULL)
endif 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 ifndef MOZ_ENABLE_LIBXUL
check:: $(PROGRAM) check:: $(PROGRAM)
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCrashReporterAPI $(RUN_TEST_PROGRAM) $(DIST)/bin/TestCrashReporterAPI

View File

@ -278,6 +278,7 @@ def GetPlatformSpecificDumper(**kwargs):
return {'win32': Dumper_Win32, return {'win32': Dumper_Win32,
'cygwin': Dumper_Win32, 'cygwin': Dumper_Win32,
'linux2': Dumper_Linux, 'linux2': Dumper_Linux,
'sunos5': Dumper_Solaris,
'darwin': Dumper_Mac}[sys.platform](**kwargs) 'darwin': Dumper_Mac}[sys.platform](**kwargs)
def SourceIndex(fileStream, outputPath): def SourceIndex(fileStream, outputPath):
@ -402,6 +403,11 @@ class Dumper:
if line.startswith("FILE"): if line.startswith("FILE"):
# FILE index filename # FILE index filename
(x, index, filename) = line.split(None, 2) (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()) filename = self.FixFilenameCase(filename.rstrip())
sourcepath = filename sourcepath = filename
if self.vcsinfo: if self.vcsinfo:
@ -528,6 +534,24 @@ class Dumper_Linux(Dumper):
os.system("gzip %s" % full_path) os.system("gzip %s" % full_path)
print rel_path + ".gz" 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): class Dumper_Mac(Dumper):
def ShouldProcess(self, file): def ShouldProcess(self, file):
"""This function will allow processing of files that are """This function will allow processing of files that are

View File

@ -226,6 +226,10 @@ ifeq ($(OS_ARCH),BeOS)
EXTRA_DSO_LDOPTS += -lbe -ltracker EXTRA_DSO_LDOPTS += -lbe -ltracker
endif endif
ifeq ($(OS_ARCH),SunOS)
EXTRA_DSO_LDOPTS += -lelf -ldemangle -lCstd
endif
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32) EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32)
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))

View File

@ -203,6 +203,15 @@ SHARED_LIBRARY_LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \ $(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
endif 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 endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk