From 034ff0a3056fc6a993c59708b3eae0da98ab026e Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sat, 5 Oct 2013 19:33:58 +0200 Subject: [PATCH] Fix google breakpad for standalone. The normal usage is to include the src/ directory of google breakpad in your application and then include client/ARCH/handler/exception_handler.h where ARCH is windows, mac or linux. However, Linden Lab for some reason packaged the breakpad prebuilt with exception_handler.h installed in ../google_breakpad/exception_handler.h where "../google_breakpad" is the 'root' of the include tree comparable with 'src' in the source tree of google breakpad. Hence, instead of including 'src' one now must include '../include/google_breakpad' which was already done correctly for non-standable, but not for standalone (BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR was set to '../include' with the 'google_breakpad' and is subsequently never used: instead BREAKPAD_INCLUDE_DIRECTORIES is used (which is set for non-standalone)). Therefore one much not include "google_breakpad/exception_handler.h", but just "exception_handler.h" or you rely on somehow the directory *below* BREAKPAD_INCLUDE_DIRECTORIES to be part of the include path as well. Finally LL packages the prebuilt if another duplicate minidump_descriptor.h in the include root. Also here including "minidump_descriptor.h" would be better correct, but following the instructions by Google this time we might as well include the original "client/linux/handler/minidump_descriptor.h". My repo (http://github.com/AlericInglewood/3p-google-breakpad) doesn't even put minidump_descriptor.h in the root anymore, only exception_handler.h. The rest is an exact copy of the 'src' tree with regard to the headers. Tested to compile both standalone and non-standalone. --- indra/cmake/FindGoogleBreakpad.cmake | 14 ++++++++------ indra/cmake/GoogleBreakpad.cmake | 2 +- indra/llcommon/llapp.cpp | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/indra/cmake/FindGoogleBreakpad.cmake b/indra/cmake/FindGoogleBreakpad.cmake index 1a0493be5..d4b2eb1b3 100644 --- a/indra/cmake/FindGoogleBreakpad.cmake +++ b/indra/cmake/FindGoogleBreakpad.cmake @@ -3,25 +3,27 @@ # - Find Google BreakPad # Find the Google BreakPad includes and library # This module defines -# BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR, where to find exception_handler.h, etc. +# BREAKPAD_INCLUDE_DIRECTORIES, where to find the Goole BreakPad includes. # BREAKPAD_EXCEPTION_HANDLER_LIBRARIES, the libraries needed to use Google BreakPad. # BREAKPAD_EXCEPTION_HANDLER_FOUND, If false, do not try to use Google BreakPad. # also defined, but not for general use are # BREAKPAD_EXCEPTION_HANDLER_LIBRARY, where to find the Google BreakPad library. -FIND_PATH(BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR google_breakpad/exception_handler.h) +FIND_PATH(BREAKPAD_INCLUDE_DIRECTORIES common/using_std_string.h PATH_SUFFIXES google_breakpad) + +MESSAGE("BREAKPAD_INCLUDE_DIRECTORIES = \"${BREAKPAD_INCLUDE_DIRECTORIES}\".") SET(BREAKPAD_EXCEPTION_HANDLER_NAMES ${BREAKPAD_EXCEPTION_HANDLER_NAMES} breakpad_client) FIND_LIBRARY(BREAKPAD_EXCEPTION_HANDLER_LIBRARY NAMES ${BREAKPAD_EXCEPTION_HANDLER_NAMES} ) -IF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR) +IF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_INCLUDE_DIRECTORIES) SET(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES ${BREAKPAD_EXCEPTION_HANDLER_LIBRARY}) SET(BREAKPAD_EXCEPTION_HANDLER_FOUND "YES") -ELSE (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR) +ELSE (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_INCLUDE_DIRECTORIES) SET(BREAKPAD_EXCEPTION_HANDLER_FOUND "NO") -ENDIF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR) +ENDIF (BREAKPAD_EXCEPTION_HANDLER_LIBRARY AND BREAKPAD_INCLUDE_DIRECTORIES) IF (BREAKPAD_EXCEPTION_HANDLER_FOUND) @@ -36,5 +38,5 @@ ENDIF (BREAKPAD_EXCEPTION_HANDLER_FOUND) MARK_AS_ADVANCED( BREAKPAD_EXCEPTION_HANDLER_LIBRARY - BREAKPAD_EXCEPTION_HANDLER_INCLUDE_DIR + BREAKPAD_INCLUDE_DIRECTORIES ) diff --git a/indra/cmake/GoogleBreakpad.cmake b/indra/cmake/GoogleBreakpad.cmake index 20149c49f..69e54ee1b 100644 --- a/indra/cmake/GoogleBreakpad.cmake +++ b/indra/cmake/GoogleBreakpad.cmake @@ -16,6 +16,6 @@ else (STANDALONE) set(BREAKPAD_EXCEPTION_HANDLER_LIBRARIES exception_handler crash_generation_client crash_generation_server common) endif (WINDOWS) # yes, this does look dumb, no, it's not incorrect - # + # I think it's incorrect: the second one should go --Aleric set(BREAKPAD_INCLUDE_DIRECTORIES "${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/google_breakpad" "${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/google_breakpad/google_breakpad") endif (STANDALONE) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 0c494a56a..2026a9e4d 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -45,7 +45,7 @@ #include "llstl.h" // for DeletePointer() #include "llstring.h" #include "lleventtimer.h" -#include "google_breakpad/exception_handler.h" +#include "exception_handler.h" // // Signal handling @@ -70,7 +70,7 @@ void setup_signals(); void default_unix_signal_handler(int signum, siginfo_t *info, void *); #if LL_LINUX -#include "google_breakpad/minidump_descriptor.h" +#include "client/linux/handler/minidump_descriptor.h" static bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc, void* context, bool succeeded);