From 1a99cdbb36334e17c34b38dd5df1bdd70167b42a Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 4 Aug 2010 14:15:35 +0200 Subject: Add breakpad support Breakpad is a portable crash handler. It sends the raw crash information to a server for analysis. This analysis needs debug information. Consequently, we compile with debug info even in release mode if qt-breakpad integration is requested (via an environment variable). Reviewed-by: ossi --- mkspecs/common/g++.conf | 2 + mkspecs/common/mac-g++.conf | 3 ++ mkspecs/features/default_post.prf | 88 +++++++++++++++++++++++++++++++++++++++ mkspecs/win32-msvc2003/qmake.conf | 3 ++ mkspecs/win32-msvc2005/qmake.conf | 3 ++ mkspecs/win32-msvc2008/qmake.conf | 3 ++ mkspecs/win32-msvc2010/qmake.conf | 3 ++ 7 files changed, 105 insertions(+) diff --git a/mkspecs/common/g++.conf b/mkspecs/common/g++.conf index d3db24a..0d511fc 100644 --- a/mkspecs/common/g++.conf +++ b/mkspecs/common/g++.conf @@ -8,6 +8,7 @@ QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC @@ -22,6 +23,7 @@ QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB diff --git a/mkspecs/common/mac-g++.conf b/mkspecs/common/mac-g++.conf index 446547d..29b7408 100644 --- a/mkspecs/common/mac-g++.conf +++ b/mkspecs/common/mac-g++.conf @@ -10,6 +10,7 @@ QMAKE_CFLAGS_DEPS += -M QMAKE_CFLAGS_WARN_ON += -Wall -W QMAKE_CFLAGS_WARN_OFF += -w QMAKE_CFLAGS_RELEASE += -O2 +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g -gdwarf-2 QMAKE_CFLAGS_DEBUG += -g QMAKE_CFLAGS_SHLIB += -fPIC QMAKE_CFLAGS_STATIC_LIB += -fPIC @@ -33,6 +34,7 @@ QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB @@ -52,6 +54,7 @@ QMAKE_LINK_C = $$QMAKE_CC QMAKE_LINK_C_SHLIB = $$QMAKE_CC QMAKE_LFLAGS += -headerpad_max_install_names QMAKE_LFLAGS_RELEASE += +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g -gdwarf-2 QMAKE_LFLAGS_DEBUG += QMAKE_LFLAGS_APP += QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index d844385..59a5e86 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -1,3 +1,15 @@ +QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) +!isEmpty(QT_BREAKPAD_ROOT_PATH): \ # quick test first whether requested ... + !staticlib:!static:CONFIG(release, debug|release):contains(TEMPLATE, .*(app|lib)): \ # is it applicable? + !contains(TARGET, .*phony_target.*): \ # monster hack, you don't really see this here, right? ;) + system($$QT_BREAKPAD_ROOT_PATH/qtbreakpadsymbols --breakpad-exists) { # do we really have it? + CONFIG += breakpad + CONFIG -= no_debug_info separate_debug_info + QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO + QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO + QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO +} + CONFIG(debug, debug|release):load(debug) else:load(release) debug_and_release:load(debug_and_release) @@ -6,6 +18,82 @@ incredibuild_xge { CONFIG = incredibuild_xge $$CONFIG } +breakpad { + !contains(DESTDIR, (/|.:[/\\\\]).*):TARGET_BASEPATH = $${OUT_PWD}/ + !isEmpty(DESTDIR):TARGET_BASEPATH = $${TARGET_BASEPATH}$${DESTDIR}/ + + win32 { + TARGET_BASEPATH ~= s,/,\\, + contains(TEMPLATE, .*lib) { + isEmpty(TARGET_VERSION_EXT):!isEmpty(VERSION) { + TARGET_VERSION_EXT = $$section(VERSION, ., 0, 0) + isEqual(TARGET_VERSION_EXT, 0):unset(TARGET_VERSION_EXT) + } + TARGET_EXT = .dll + } else { + TARGET_EXT = .exe + } + + DEBUGFILENAME = $${TARGET_BASEPATH}$${TARGET}$${TARGET_VERSION_EXT}$${TARGET_EXT} + PDBFILENAME = $${TARGET_BASEPATH}$${TARGET}$${TARGET_VERSION_EXT}.pdb + DEBUGFILENAME ~= s,/,\\, + PDBFILENAME ~= s,/,\\, + QMAKE_CLEAN += $$PDBFILENAME # for the debug case it is hardcoded in qmake + } else { + contains(TEMPLATE, .*lib):LIBPREFIX = lib + + macx { + equals(TEMPLATE, lib) { + lib_bundle { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.framework/$${TARGET} + } else { + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET} + !plugin { + TEMP_VERSION = $$section(VERSION, ., 0, 0) + isEmpty(TEMP_VERSION):TEMP_VERSION = 1 + TARGET_FILENAME = $${TARGET_FILENAME}.$${TEMP_VERSION} + } + TARGET_FILENAME = $${TARGET_FILENAME}.$${QMAKE_EXTENSION_SHLIB} + } + } else { + app_bundle { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET}.app/Contents/MacOS/$${TARGET} + } else { + TARGET_FILENAME = $${TARGET_BASEPATH}$${TARGET} + } + } + DEBUGFILENAME = $$TARGET_FILENAME + } else { + equals(TEMPLATE, lib) { + plugin { + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so + } else { + TEMP_VERSION = $$VERSION + isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0 + TARGET_FILENAME = $${TARGET_BASEPATH}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} + } + } else { + TARGET_BASEPATH = $${TARGET_BASEPATH}$${TARGET} + } + DEBUGFILENAME = $$TARGET_BASEPATH + } + } + + PROJECTPATH = $$OUT_PWD + win32:PROJECTPATH ~= s,/,\\, + + !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t) + QMAKE_POST_LINK += $$quote($${QT_BREAKPAD_ROOT_PATH}$${DIR_SEPARATOR}qtbreakpadsymbols \"$$DEBUGFILENAME\" \"$$PROJECTPATH\") + !isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$quote($$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$QMAKE_STRIP \"$$DEBUGFILENAME\") + + unset(TARGET_BASEPATH) + unset(TARGET_FILENAME) + unset(SYMBOLFILENAME) + unset(TARGET_EXT) + unset(TARGET_VERSION_EXT) + unset(TEMP_VERSION) +} + QMAKE_INCDIR += $$QMAKE_INCDIR_POST QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST diff --git a/mkspecs/win32-msvc2003/qmake.conf b/mkspecs/win32-msvc2003/qmake.conf index 0230b30..63d1ffd 100644 --- a/mkspecs/win32-msvc2003/qmake.conf +++ b/mkspecs/win32-msvc2003/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm300 QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = @@ -28,6 +29,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_STL_ON = -EHsc @@ -51,6 +53,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 0406fd0..265d028 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -29,6 +30,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -53,6 +55,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 9a69aaa..1432645 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -55,6 +57,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 8331c14..84086e2 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -20,6 +20,7 @@ QMAKE_CFLAGS = -nologo -Zm200 -Zc:wchar_t- QMAKE_CFLAGS_WARN_ON = -W3 QMAKE_CFLAGS_WARN_OFF = -W0 QMAKE_CFLAGS_RELEASE = -O2 -MD +QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi QMAKE_CFLAGS_DEBUG = -Zi -MDd QMAKE_CFLAGS_YACC = QMAKE_CFLAGS_LTCG = -GL @@ -30,6 +31,7 @@ QMAKE_CXXFLAGS = $$QMAKE_CFLAGS QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -w34100 -w34189 QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG @@ -55,6 +57,7 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<< QMAKE_LINK = link QMAKE_LFLAGS = /NOLOGO QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO +QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /INCREMENTAL:NO /DEBUG QMAKE_LFLAGS_DEBUG = /DEBUG QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" -- cgit v0.12