Bug 769048 part C - Build an injector DLL which can watch for crashes in Flash player processes. This involves building two copies of breakpad: one to live inside of libxul which uses mozalloc and the dynamic CRT, another to link into the injector which links the CRT statically and doesn't use mozalloc. Introduce a new define/makefile variable MOZ_CRASHREPORTER_INJECTOR rather than repeating "#if defined(XP_WIN) && !defined(HAVE_64BIT_OS) in many places. r=ehsan/khuey

--HG--
extra : rebase_source : 33bd0a74ce70a564963a6ca125e01048577fb554
This commit is contained in:
Benjamin Smedberg 2012-07-02 14:55:12 -04:00
parent aa652cb295
commit 1df5f270e1
19 changed files with 182 additions and 123 deletions

View File

@ -661,6 +661,9 @@ bin/libfreebl_32int64_3.so
#endif
#endif
@BINPATH@/crashreporter-override.ini
#ifdef MOZ_CRASHREPORTER_INJECTOR
@BINPATH@/breakpadinjector.dll
#endif
#endif
; [Extensions]

View File

@ -156,6 +156,7 @@ LIBJPEG_TURBO_ARM_ASM = @LIBJPEG_TURBO_ARM_ASM@
NS_PRINTING = @NS_PRINTING@
MOZ_PDF_PRINTING = @MOZ_PDF_PRINTING@
MOZ_CRASHREPORTER = @MOZ_CRASHREPORTER@
MOZ_CRASHREPORTER_INJECTOR = @MOZ_CRASHREPORTER_INJECTOR@
MOZ_HELP_VIEWER = @MOZ_HELP_VIEWER@
MOC = @MOC@
RCC = @RCC@

View File

@ -5890,6 +5890,11 @@ if test -n "$MOZ_CRASHREPORTER"; then
if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
fi
if test "$OS_ARCH" == "WINNT" -a -z "$HAVE_64BIT_OS"; then
MOZ_CRASHREPORTER_INJECTOR=1
AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
fi
fi
MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
@ -8359,6 +8364,7 @@ AC_SUBST(MOZ_SPELLCHECK)
AC_SUBST(MOZ_JAVA_COMPOSITOR)
AC_SUBST(MOZ_ONLY_TOUCH_EVENTS)
AC_SUBST(MOZ_CRASHREPORTER)
AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR)

View File

@ -14,12 +14,10 @@ LIBXUL_LIBRARY = 1
LIBRARY_NAME = exception_handler_s
ifeq ($(OS_ARCH),WINNT)
DIRS += \
google-breakpad/src/common/windows \
google-breakpad/src/client/windows/handler \
google-breakpad/src/client/windows/sender \
google-breakpad/src/client/windows/crash_generation \
$(NULL)
DIRS += breakpad-windows-libxul
ifdef MOZ_CRASHREPORTER_INJECTOR
DIRS += breakpad-windows-standalone
endif
endif
ifeq ($(OS_ARCH),Darwin)
@ -74,6 +72,10 @@ endif
DIRS += client
ifdef MOZ_CRASHREPORTER_INJECTOR
DIRS += injector
endif
LOCAL_INCLUDES = -I$(srcdir)/google-breakpad/src
DEFINES += -DUNICODE -D_UNICODE

View File

@ -0,0 +1,41 @@
# 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/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = google_breakpad_libxul_s
FORCE_STATIC_LIB = 1
STL_FLAGS =
LOCAL_INCLUDES = -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/windows/objs.mk
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/objs.mk
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/sender/objs.mk
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/objs.mk
VPATH += \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/windows \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/handler \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/sender \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation \
$(NULL)
CPPSRCS = \
$(objs_common) \
$(objs_handler) \
$(objs_sender) \
$(objs_crash_generation) \
http_upload.cc \ # required for the libxul version but not standalone
$(NULL)
DEFINES += -DUNICODE -DUNICODE_ -DBREAKPAD_NO_TERMINATE_THREAD -DNOMINMAX
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,39 @@
# 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/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = google_breakpad_standalone_s
FORCE_STATIC_LIB = 1
USE_STATIC_LIBS = 1
MOZ_GLUE_LDFLAGS =
STL_FLAGS =
LOCAL_INCLUDES = -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/windows/objs.mk
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/objs.mk
include $(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/objs.mk
VPATH += \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/common/windows \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/handler \
$(topsrcdir)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation \
$(NULL)
CPPSRCS = \
$(objs_common) \
$(objs_handler) \
$(objs_crash_generation) \
$(NULL)
DEFINES += -DUNICODE -DUNICODE_ -DBREAKPAD_NO_TERMINATE_THREAD -DNOMINMAX
include $(topsrcdir)/config/rules.mk

View File

@ -37,8 +37,7 @@ CPPSRCS = \
ifeq ($(OS_ARCH),WINNT)
CPPSRCS += crashreporter_win.cpp
LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/sender/$(LIB_PREFIX)crash_report_sender_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/windows/$(LIB_PREFIX)breakpad_windows_common_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/breakpad-windows-libxul/$(LIB_PREFIX)google_breakpad_libxul_s.$(LIB_SUFFIX)
$(NULL)
LOCAL_INCLUDES += -I$(srcdir)
RCINCLUDE = crashreporter.rc

View File

@ -1,28 +0,0 @@
# 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/.
DEPTH = ../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = crash_generation
LIBRARY_NAME = crash_generation_s
LOCAL_INCLUDES = -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
DEFINES += -DUNICODE -D_UNICODE
CPPSRCS = \
client_info.cc \
crash_generation_client.cc \
crash_generation_server.cc \
minidump_generator.cc \
$(NULL)
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,6 @@
objs_crash_generation = \
client_info.cc \
crash_generation_client.cc \
crash_generation_server.cc \
minidump_generator.cc \
$(NULL)

View File

@ -1,26 +0,0 @@
# 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/.
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$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
DEFINES += -DUNICODE -D_UNICODE -DBREAKPAD_NO_TERMINATE_THREAD -DNOMINMAX
CPPSRCS = \
exception_handler.cc \
$(NULL)
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1 @@
objs_handler = exception_handler.cc

View File

@ -1,26 +0,0 @@
# 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/.
DEPTH = ../../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = sender
LIBRARY_NAME = crash_report_sender_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
DEFINES += -DUNICODE -D_UNICODE
STL_FLAGS =
CPPSRCS = \
crash_report_sender.cc \
$(NULL)
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1 @@
objs_sender = crash_report_sender.cc

View File

@ -1,28 +0,0 @@
# 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/.
DEPTH = ../../../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = breakpad_windows_common
LIBRARY_NAME = breakpad_windows_common_s
LOCAL_INCLUDES = -I$(srcdir)/../..
DEFINES += -DUNICODE -D_UNICODE
STL_FLAGS =
CPPSRCS = \
guid_string.cc \
http_upload.cc \
string_utils.cc \
$(NULL)
# need static lib
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,4 @@
objs_common = \
guid_string.cc \
string_utils.cc \
$(NULL)

View File

@ -0,0 +1,27 @@
# 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/.
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = breakpadinjector
FORCE_SHARED_LIB = 1
USE_STATIC_LIBS = 1
STL_FLAGS =
MOZ_GLUE_LDFLAGS =
CPPSRCS = injector.cpp
SHARED_LIBRARY_LIBS += ../breakpad-windows-standalone/$(LIB_PREFIX)google_breakpad_standalone_s.$(LIB_SUFFIX)
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
LDFLAGS += -ENTRY:DummyEntryPoint

View File

@ -0,0 +1,40 @@
/* 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/. */
#include <windows.h>
#include "client/windows/handler/exception_handler.h"
using google_breakpad::ExceptionHandler;
using std::wstring;
BOOL WINAPI DummyEntryPoint(HINSTANCE instance,
DWORD reason,
void* reserved)
{
__debugbreak();
return FALSE; // We're being loaded remotely, this shouldn't happen!
}
// support.microsoft.com/kb/94248
extern "C" BOOL WINAPI _CRT_INIT(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved);
extern "C"
__declspec(dllexport) DWORD Start(void* context)
{
// Because the remote DLL injector does not call DllMain, we have to
// initialize the CRT manually
_CRT_INIT(NULL, DLL_PROCESS_ATTACH, NULL);
HANDLE hCrashPipe = reinterpret_cast<HANDLE>(context);
ExceptionHandler* e = new (std::nothrow)
ExceptionHandler(wstring(), NULL, NULL, NULL,
ExceptionHandler::HANDLER_ALL,
MiniDumpNormal, hCrashPipe, NULL);
if (e)
e->set_handle_debug_exceptions(true);
return 1;
}

View File

@ -1148,10 +1148,9 @@ if [ "$MOZ_CRASHREPORTER" ]; then
"
if [ "$OS_ARCH" = "WINNT" ]; then
add_makefiles "
toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/Makefile
toolkit/crashreporter/google-breakpad/src/client/windows/handler/Makefile
toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile
toolkit/crashreporter/google-breakpad/src/common/windows/Makefile
toolkit/crashreporter/breakpad-windows-libxul/Makefile
toolkit/crashreporter/breakpad-windows-standalone/Makefile
toolkit/crashreporter/injector/Makefile
"
elif [ "$OS_ARCH" = "Darwin" ]; then
add_makefiles "

View File

@ -128,9 +128,7 @@ ifdef MOZ_CRASHREPORTER
SHARED_LIBRARY_LIBS += $(DEPTH)/toolkit/crashreporter/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX)
ifeq ($(OS_ARCH),WINNT)
SHARED_LIBRARY_LIBS += \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/handler/$(LIB_PREFIX)exception_handler_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/$(LIB_PREFIX)crash_generation_s.$(LIB_SUFFIX) \
$(DEPTH)/toolkit/crashreporter/google-breakpad/src/common/windows/$(LIB_PREFIX)breakpad_windows_common_s.$(LIB_SUFFIX)
$(DEPTH)/toolkit/crashreporter/breakpad-windows-libxul/$(LIB_PREFIX)google_breakpad_libxul_s.$(LIB_SUFFIX)
endif
ifeq ($(OS_ARCH),Darwin)