bug 380541 - build time logic to extract debug symbols on Linux - first cut at integrating Breakpad on Linux. r=mento
--- a/Makefile.in
+++ b/Makefile.in
@@ -153,16 +153,22 @@ MAKE_SYM_STORE_ARGS := -a $(OS_TEST)
SYM_DIST := $(DIST)
endif
# |file| is stupid on universal binaries, it produces one line of output
# for the file, and one line of output for each architecture contained within.
SYM_FIND_CMD := find -L $(SYM_DIST) -type f -a -perm -100 -o -name "*.dylib" \
| xargs file -L | grep "Mach-O" | grep -v "for architecture" | cut -f1 -d':'
DUMP_SYMS_BIN := $(DIST)/host/bin/dump_syms
endif
+ifeq ($(OS_ARCH),Linux)
+MAKE_SYM_STORE_ARGS :=
+SYM_FIND_CMD := find -L $(DIST)/bin -type f -a -perm -100 -o -name "*.so" \
+ | xargs file -L | grep "ELF" | cut -f1 -d':'
+DUMP_SYMS_BIN := $(DIST)/host/bin/dump_syms
+endif
buildsymbols:
ifdef MOZ_AIRBAG
echo building symbol store
mkdir -p $(DIST)/crashreporter-symbols/$(BUILDID)
$(SYM_FIND_CMD) | \
xargs $(topsrcdir)/toolkit/airbag/tools/make_symbol_store.pl \
$(MAKE_SYM_STORE_ARGS) $(DUMP_SYMS_BIN) \
--- a/toolkit/airbag/Makefile.in
+++ b/toolkit/airbag/Makefile.in
@@ -65,16 +65,28 @@ DIRS += \
airbag/src/common \
airbag/src/common/mac \
airbag/src/client \
airbag/src/client/mac/handler \
airbag/src/tools/mac/dump_syms \
$(NULL)
endif
+ifeq ($(OS_ARCH),Linux)
+# there's no define for this normally
+DEFINES += -DXP_LINUX
+DIRS += \
+ airbag/src/common \
+ airbag/src/common/linux \
+ airbag/src/client \
+ airbag/src/client/linux/handler \
+ airbag/src/tools/linux/dump_syms \
+ $(NULL)
+endif
+
DIRS += client
LOCAL_INCLUDES = -I$(srcdir)/airbag/src
DEFINES += -DUNICODE -D_UNICODE
XPIDLSRCS = \
nsICrashReporter.idl \
$(NULL)
new file mode 100644
--- /dev/null
+++ b/toolkit/airbag/airbag/src/client/linux/handler/Makefile.in
@@ -0,0 +1,59 @@
+# ***** 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
+# Ted Mielczarek <ted.mielczarek@gmail.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 \
+ linux_thread.cc \
+ $(NULL)
+
+# need static lib
+FORCE_STATIC_LIB = 1
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/toolkit/airbag/airbag/src/common/linux/Makefile.in
@@ -0,0 +1,75 @@
+# ***** 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
+# Ted Mielczarek <ted.mielczarek@gmail.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_linux_common
+LIBRARY_NAME = breakpad_linux_common_s
+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 = \
+ dump_symbols.cc \
+ file_id.cc \
+ guid_creator.cc \
+ $(NULL)
+
+CSRCS = \
+ md5.c \
+ $(NULL)
+
+HOST_CPPSRCS = \
+ dump_symbols.cc \
+ file_id.cc \
+ guid_creator.cc \
+ $(NULL)
+
+HOST_CSRCS = $(CSRCS)
+
+# need static lib
+FORCE_STATIC_LIB = 1
+
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/toolkit/airbag/airbag/src/tools/linux/dump_syms/Makefile.in
@@ -0,0 +1,63 @@
+# ***** 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
+# Ted Mielczarek <ted.mielczarek@gmail.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/linux \
+ $(NULL)
+
+HOST_CPPSRCS = \
+ dump_syms.cc \
+ $(NULL)
+
+HOST_LIBS += \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/linux/$(LIB_PREFIX)host_breakpad_linux_common_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/$(LIB_PREFIX)host_breakpad_common_s.$(LIB_SUFFIX) \
+ $(NULL)
+
+# force C++ linking
+CPP_PROG_LINK = 1
+
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/airbag/client/Makefile.in
+++ b/toolkit/airbag/client/Makefile.in
@@ -74,16 +74,24 @@ OS_LIBS += -framework Cocoa
LIBS += \
$(DEPTH)/toolkit/airbag/airbag/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) \
$(NULL)
LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../airbag/src/common/mac/
endif
+ifeq ($(OS_ARCH),Linux)
+CPPSRCS += crashreporter_linux.cpp
+LIBS += \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
+ $(NULL)
+LOCAL_INCLUDES += -I$(srcdir)
+endif
+
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Darwin)
libs::
$(NSINSTALL) -D $(DIST)/bin/crashreporter.app
rsync -a -C --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/bin/crashreporter.app
sed -e "s/@APP_NAME@/$(MOZ_APP_DISPLAYNAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
iconv -f UTF-8 -t UTF-16 > $(DIST)/bin/crashreporter.app/Contents/Resources/English.lproj/InfoPlist.strings
new file mode 100644
--- /dev/null
+++ b/toolkit/airbag/client/crashreporter_linux.cpp
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** 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 Toolkit Crash Reporter
+ *
+ * The Initial Developer of the Original Code is
+ * Ted Mielczarek <ted.mielczarek@gmail.com>
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * 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 ***** */
+
+#include "crashreporter.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <algorithm>
+#include <cctype>
+
+using std::string;
+
+bool UIInit()
+{
+ //XXX: implement me
+ return true;
+}
+
+void UIShutdown()
+{
+ //XXX: implement me
+}
+
+void UIShowDefaultUI()
+{
+ //XXX: implement me
+}
+
+void UIShowCrashUI(const string& dumpfile,
+ const StringTable& queryParameters,
+ const string& sendURL)
+{
+ //XXX: implement me
+}
+
+void UIError(const string& message)
+{
+ //XXX: implement me
+ printf("Error: %s\n", message.c_str());
+}
+
+bool UIGetIniPath(string& path)
+{
+ path = gArgv[0];
+ path.append(".ini");
+
+ return true;
+}
+
+/*
+ * Settings are stored in ~/.vendor/product, or
+ * ~/.product if vendor is empty.
+ */
+bool UIGetSettingsPath(const string& vendor,
+ const string& product,
+ string& settingsPath)
+{
+ char* home = getenv("HOME");
+
+ if (!home)
+ return false;
+
+ settingsPath = home;
+ settingsPath += "/.";
+ if (!vendor.empty()) {
+ string lc_vendor;
+ std::transform(vendor.begin(), vendor.end(), back_inserter(lc_vendor),
+ (int(*)(int)) std::tolower);
+ settingsPath += lc_vendor + "/";
+ }
+ string lc_product;
+ std::transform(product.begin(), product.end(), back_inserter(lc_product),
+ (int(*)(int)) std::tolower);
+ settingsPath += lc_product + "/Crash Reports";
+ printf("settingsPath: %s\n", settingsPath.c_str());
+ return UIEnsurePathExists(settingsPath);
+}
+
+bool UIEnsurePathExists(const string& path)
+{
+ int ret = mkdir(path.c_str(), S_IRWXU);
+ int e = errno;
+ if (ret == -1 && e != EEXIST)
+ return false;
+
+ return true;
+}
+
+bool UIMoveFile(const string& file, const string& newfile)
+{
+ return (rename(file.c_str(), newfile.c_str()) != -1);
+}
+
+bool UIDeleteFile(const string& file)
+{
+ return (unlink(file.c_str()) != -1);
+}
--- a/toolkit/airbag/nsAirbagExceptionHandler.cpp
+++ b/toolkit/airbag/nsAirbagExceptionHandler.cpp
@@ -44,16 +44,19 @@
#include "client/windows/handler/exception_handler.h"
#include <string.h>
#elif defined(XP_MACOSX)
#include "client/mac/handler/exception_handler.h"
#include <string>
#include <Carbon/Carbon.h>
#include <fcntl.h>
+#elif defined(XP_LINUX)
+#include "client/linux/handler/exception_handler.h"
+#include <fcntl.h>
#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-airbag."
#endif
@@ -211,88 +214,16 @@ bool MinidumpCallback(const XP_CHAR* dum
crashReporterPath, minidumpPath, (char*)0);
_exit(1);
}
#endif
return succeeded;
}
-static nsresult GetExecutablePath(nsString& exePath)
-{
-#if !defined(XP_MACOSX)
-
-#ifdef XP_WIN32
- exePath.SetLength(XP_PATH_MAX);
- if (!GetModuleFileName(NULL, (LPWSTR)exePath.BeginWriting(), XP_PATH_MAX))
- return NS_ERROR_FAILURE;
-#else
- return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-
- NS_NAMED_LITERAL_STRING(pathSep, PATH_SEPARATOR);
-
- PRInt32 lastSlash = exePath.RFind(pathSep);
- if (lastSlash < 0)
- return NS_ERROR_FAILURE;
-
- exePath.Truncate(lastSlash + 1);
-
- return NS_OK;
-
-#else // !defined(XP_MACOSX)
-
- CFBundleRef appBundle = CFBundleGetMainBundle();
- if (!appBundle)
- return NS_ERROR_FAILURE;
-
- CFURLRef executableURL = CFBundleCopyExecutableURL(appBundle);
- if (!executableURL)
- return NS_ERROR_FAILURE;
-
- CFURLRef bundleURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
- executableURL);
- CFRelease(executableURL);
-
- if (!bundleURL)
- return NS_ERROR_FAILURE;
-
- CFURLRef reporterURL = CFURLCreateCopyAppendingPathComponent(
- NULL,
- bundleURL,
- CFSTR("crashreporter.app/Contents/MacOS/"),
- false);
- CFRelease(bundleURL);
-
- if (!reporterURL)
- return NS_ERROR_FAILURE;
-
- FSRef fsRef;
- if (!CFURLGetFSRef(reporterURL, &fsRef)) {
- CFRelease(reporterURL);
- return NS_ERROR_FAILURE;
- }
-
- CFRelease(reporterURL);
-
- char path[PATH_MAX + 1];
- OSStatus status = FSRefMakePath(&fsRef, (UInt8*)path, PATH_MAX);
- if (status != noErr)
- return NS_ERROR_FAILURE;
-
- int len = strlen(path);
- path[len] = '/';
- path[len + 1] = '\0';
-
- exePath = NS_ConvertUTF8toUTF16(path);
-
- return NS_OK;
-#endif
-}
-
nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
const char* aServerURL)
{
nsresult rv;
if (gExceptionHandler)
return NS_ERROR_ALREADY_INITIALIZED;
@@ -311,31 +242,24 @@ nsresult SetExceptionHandler(nsILocalFil
NS_ENSURE_TRUE(crashReporterAPIData_Hash, NS_ERROR_OUT_OF_MEMORY);
rv = crashReporterAPIData_Hash->Init();
NS_ENSURE_SUCCESS(rv, rv);
// locate crashreporter executable
nsString exePath;
- if (aXREDirectory) {
- aXREDirectory->GetPath(exePath);
- }
- else {
- rv = GetExecutablePath(exePath);
- NS_ENSURE_SUCCESS(rv, rv);
- }
-
+ aXREDirectory->GetPath(exePath);
NS_NAMED_LITERAL_STRING(crashReporterFilename, CRASH_REPORTER_FILENAME);
crashReporterPath = TO_NEW_XP_CHAR(exePath + crashReporterFilename);
// get temp path to use for minidump path
nsString tempPath;
-#ifdef XP_WIN32
+#if defined(XP_WIN32)
// first figure out buffer size
int pathLen = GetTempPath(0, NULL);
if (pathLen == 0)
return NS_ERROR_FAILURE;
tempPath.SetLength(pathLen);
GetTempPath(pathLen, (LPWSTR)tempPath.BeginWriting());
#elif defined(XP_MACOSX)
@@ -346,16 +270,19 @@ nsresult SetExceptionHandler(nsILocalFil
return NS_ERROR_FAILURE;
char path[PATH_MAX];
OSStatus status = FSRefMakePath(&fsRef, (UInt8*)path, PATH_MAX);
if (status != noErr)
return NS_ERROR_FAILURE;
tempPath = NS_ConvertUTF8toUTF16(path);
+#elif defined(XP_UNIX)
+ // we assume it's always /tmp on unix systems
+ tempPath = NS_LITERAL_STRING("/tmp/");
#else
//XXX: implement get temp path on other platforms
return NS_ERROR_NOT_IMPLEMENTED;
#endif
// now set the exception handler
gExceptionHandler = new google_breakpad::
ExceptionHandler(CONVERT_UTF16_TO_XP_CHAR(tempPath).get(),
--- a/toolkit/airbag/test/Makefile.in
+++ b/toolkit/airbag/test/Makefile.in
@@ -80,12 +80,21 @@ LIBS += \
$(DEPTH)/toolkit/airbag/airbag/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX) \
$(NULL)
LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../airbag/src/common/mac/
endif
+ifeq ($(OS_ARCH),Linux)
+LIBS += \
+ $(DEPTH)/toolkit/airbag/airbag/src/client/linux/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
+ $(NULL)
+endif
+
ifndef MOZ_ENABLE_LIBXUL
check:: $(PROGRAM)
$(RUN_TEST_PROGRAM) $(DIST)/bin/TestCrashReporterAPI
endif
--- a/toolkit/airbag/test/TestCrashReporterAPI.cpp
+++ b/toolkit/airbag/test/TestCrashReporterAPI.cpp
@@ -57,18 +57,25 @@
return message; } while (0)
#define mu_run_test(test) do { char *message = test(); tests_run++; \
if (message) return message; } while (0)
int tests_run;
char *
test_init_exception_handler()
{
+ nsCOMPtr<nsILocalFile> lf;
+ // we don't plan on launching the crash reporter in this app anyway,
+ // so it's ok to pass a bogus nsILocalFile
+ mu_assert("NS_NewNativeLocalFile", NS_NewNativeLocalFile(EmptyCString(),
+ PR_TRUE,
+ getter_AddRefs(lf)));
+
mu_assert("CrashReporter::SetExceptionHandler",
- CrashReporter::SetExceptionHandler(nsnull, nsnull));
+ CrashReporter::SetExceptionHandler(lf, nsnull));
return 0;
}
char *
test_set_minidump_path()
{
nsresult rv;
nsCOMPtr<nsIProperties> directoryService =
--- a/toolkit/airbag/tools/make_symbol_store.pl
+++ b/toolkit/airbag/tools/make_symbol_store.pl
@@ -111,16 +111,21 @@ foreach my $dbgfile (@ARGV) {
next unless -f $dbgfile;
# get filename without path or .pdb extension, if it exists
my ($sf) = fileparse($dbgfile, ".pdb");
my $symfile = $symbol_path . "/" . $sf . ".sym";
foreach my $arch (@archs) {
my $a = '';
$a = "-a $arch" if $arch ne '';
system("${dump_syms} ${a} ${dbgfile} > ${symfile}");
+ # remove empty sym file, probably no debug symbols in that file
+ if (-s $symfile == 0) {
+ unlink($symfile);
+ next;
+ }
my $newpath = rename_symbol_file $symfile, $symbol_path;
if ($copy_dbg && $newpath ne "") {
my $out = $newpath;
$out =~ s/^$symbol_path//;
$out =~ s|^/||;
print "$out/${sf}.pdb\n";
copy($dbgfile, $newpath);
}
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -199,16 +199,25 @@ endif
ifeq ($(OS_ARCH),Darwin)
SHARED_LIBRARY_LIBS += \
$(DEPTH)/toolkit/airbag/airbag/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/client/mac/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/airbag/airbag/src/common/mac/$(LIB_PREFIX)breakpad_mac_common_s.$(LIB_SUFFIX)
endif
+
+ifeq ($(OS_ARCH),Linux)
+SHARED_LIBRARY_LIBS += \
+ $(DEPTH)/toolkit/airbag/airbag/src/client/linux/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/client/$(LIB_PREFIX)minidump_file_writer_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/$(LIB_PREFIX)breakpad_common_s.$(LIB_SUFFIX) \
+ $(DEPTH)/toolkit/airbag/airbag/src/common/linux/$(LIB_PREFIX)breakpad_linux_common_s.$(LIB_SUFFIX) \
+ $(NULL)
+endif
endif
include $(topsrcdir)/config/rules.mk
ifdef BUILD_STATIC_LIBS
export::
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) Apprunner
# embedding/browser/gtk/src/Makefile.in sucks! we need to add an empty line to
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2179,42 +2179,16 @@ XRE_main(int argc, char* argv[], const n
nsresult rv;
NS_TIMELINE_MARK("enter main");
#ifdef DEBUG
if (PR_GetEnv("XRE_MAIN_BREAK"))
NS_BREAK();
#endif
-#ifdef MOZ_AIRBAG
- //XXX: remove me when we turn this on by default
- const char* airbagEnv = PR_GetEnv("MOZ_AIRBAG");
- //XXX: can't set the flag here, since aAppData is const
- if (((airbagEnv && *airbagEnv) ||
- ((aAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
- aAppData->crashReporterURL)) &&
- NS_SUCCEEDED(CrashReporter::SetExceptionHandler(aAppData->xreDirectory,
- aAppData->crashReporterURL)))
- {
- // pass some basic info from the app data
- if (aAppData->vendor)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"),
- nsDependentCString(aAppData->vendor));
- if (aAppData->name)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"),
- nsDependentCString(aAppData->name));
- if (aAppData->version)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"),
- nsDependentCString(aAppData->version));
- if (aAppData->buildID)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"),
- nsDependentCString(aAppData->buildID));
- }
-#endif
-
#ifdef XP_WIN32
// Suppress the "DLL Foo could not be found" dialog, such that if dependent
// libraries (such as GDI+) are not preset, we gracefully fail to load those
// XPCOM components, instead of being ungraceful.
UINT realMode = SetErrorMode(0);
realMode |= SEM_FAILCRITICALERRORS;
// If XRE_NO_WINDOWS_CRASH_DIALOG is set, suppress displaying the "This
// application has crashed" dialog box. This is mainly useful for
@@ -2307,23 +2281,16 @@ XRE_main(int argc, char* argv[], const n
NS_CompareVersions(appData.maxVersion, TOOLKIT_EM_VERSION) < 0) {
Output(PR_TRUE, "Error: Platform version " TOOLKIT_EM_VERSION " is not compatible with\n"
"minVersion >= %s\nmaxVersion <= %s\n",
appData.minVersion, appData.maxVersion);
return 1;
}
}
-#ifdef MOZ_AIRBAG
- //XXX: remove me when this is on by default
- if (airbagEnv && *airbagEnv) {
- appData.flags |= NS_XRE_ENABLE_CRASH_REPORTER;
- }
-#endif
-
ScopedLogging log;
if (!appData.xreDirectory) {
nsCOMPtr<nsILocalFile> lf;
rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf));
if (NS_FAILED(rv))
return 2;
@@ -2332,16 +2299,43 @@ XRE_main(int argc, char* argv[], const n
if (NS_FAILED(rv))
return 2;
rv = CallQueryInterface(greDir, &appData.xreDirectory);
if (NS_FAILED(rv))
return 2;
}
+#ifdef MOZ_AIRBAG
+ //XXX: remove me when this is on by default
+ const char* airbagEnv = PR_GetEnv("MOZ_AIRBAG");
+ if (airbagEnv && *airbagEnv) {
+ appData.flags |= NS_XRE_ENABLE_CRASH_REPORTER;
+ }
+
+ if ((appData.flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
+ NS_SUCCEEDED(
+ CrashReporter::SetExceptionHandler(appData.xreDirectory,
+ appData.crashReporterURL))) {
+ // pass some basic info from the app data
+ if (appData.vendor)
+ CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"),
+ nsDependentCString(appData.vendor));
+ if (appData.name)
+ CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"),
+ nsDependentCString(appData.name));
+ if (appData.version)
+ CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"),
+ nsDependentCString(appData.version));
+ if (appData.buildID)
+ CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"),
+ nsDependentCString(appData.buildID));
+ }
+#endif
+
#ifdef XP_MACOSX
if (PR_GetEnv("MOZ_LAUNCHED_CHILD")) {
// This is needed, on relaunch, to force the OS to use the "Cocoa Dock
// API". Otherwise the call to ReceiveNextEvent() below will make it
// use the "Carbon Dock API". For more info see bmo bug 377166.
EnsureUseCocoaDockAPI();
// When the app relaunches, the original process exits. This causes