From 661cf8ff4ef55663977a74d9bccf21c50b50f513 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 7 Aug 2012 22:22:38 +0200 Subject: [PATCH] Make it possible to force generation of debug info in release builds Change-Id: Ie79e5a6a87475d5140163a2a547b4385a53fc05f Reviewed-by: Oswald Buddenhagen --- configure | 13 +++++++++++++ mkspecs/features/default_post.prf | 12 +++++++++--- tools/configure/configureapp.cpp | 16 +++++++++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 2f7c537ee5..304136c75c 100755 --- a/configure +++ b/configure @@ -691,6 +691,7 @@ CFG_QCONFIG=full CFG_DEBUG=auto CFG_MYSQL_CONFIG= CFG_DEBUG_RELEASE=no +CFG_FORCEDEBUGINFO=no CFG_SHARED=yes CFG_SM=auto CFG_XSHAPE=auto @@ -1356,6 +1357,9 @@ while [ "$#" -gt 0 ]; do debug) CFG_DEBUG="$VAL" ;; + force-debug-info) + CFG_FORCEDEBUGINFO="$VAL" + ;; developer-build|commercial|opensource) # These switches have been dealt with already ;; @@ -2501,6 +2505,10 @@ if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then QT_CONFIG="$QT_CONFIG build_all debug_and_release" fi +if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then + QT_CONFIG="$QT_CONFIG force_debug_info" +fi + # pass on $CFG_SDK to the configure tests. if [ '!' -z "$CFG_SDK" ]; then MAC_CONFIG_TEST_COMMANDLINE="$MAC_CONFIG_TEST_COMMANDLINE -sdk $CFG_SDK" @@ -2977,6 +2985,8 @@ Configure options: -debug-and-release . Compile and link two versions of Qt, with and without debugging turned on (Mac only). + -force-debug-info .. Create symbol files for release builds. + -developer-build ... Compile and link Qt with Qt developer options (including auto-tests exporting) -opensource ........ Compile and link the Open-Source Edition of Qt. @@ -6036,6 +6046,9 @@ if [ "$CFG_DEBUG_RELEASE" = "yes" ]; then else echo "Debug .................. $CFG_DEBUG" fi +if [ "$CFG_RELEASE" = "yes" ] || [ "$CFG_DEBUG_RELEASE" = "yes" ]; then + echo "Force debug info ....... $CFG_FORCEDEBUGINFO" +fi echo "C++11 support .......... $CFG_CXX11" if [ -n "$PKG_CONFIG" ]; then echo "pkg-config ............. yes" diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf index d0a2d61607..b717a8d352 100644 --- a/mkspecs/features/default_post.prf +++ b/mkspecs/features/default_post.prf @@ -12,8 +12,11 @@ QT_BREAKPAD_ROOT_PATH = $$(QT_BREAKPAD_ROOT_PATH) !staticlib:!static:CONFIG(release, debug|release):have_target: \ # 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 += breakpad force_debug_info CONFIG -= no_debug_info separate_debug_info +} + +force_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 @@ -27,10 +30,13 @@ incredibuild_xge { CONFIG = incredibuild_xge $$CONFIG } +force_debug_info:win32 { + load(resolve_target) + QMAKE_CLEAN += $$replace(QMAKE_RESOLVED_TARGET, ...$, pdb) # for the debug case it is hardcoded in qmake +} + breakpad { load(resolve_target) - win32: QMAKE_CLEAN += $$replace(QMAKE_RESOLVED_TARGET, ...$, pdb) # for the debug case it is hardcoded in qmake - DEBUGFILENAME = $$shell_quote($$shell_path($$QMAKE_RESOLVED_TARGET)) PROJECTPATH = $$shell_quote($$shell_path($$OUT_PWD)) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 126edb966b..d92a3237be 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -276,6 +276,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "BUILD" ] = "debug"; dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly + dictionary[ "FORCEDEBUGINFO" ] = "no"; dictionary[ "BUILDTYPE" ] = "none"; @@ -459,6 +460,8 @@ void Configure::parseCmdLine() dictionary[ "BUILDALL" ] = "no"; } else if (configCmdLine.at(i) == "-debug-and-release") dictionary[ "BUILDALL" ] = "yes"; + else if (configCmdLine.at(i) == "-force-debug-info") + dictionary[ "FORCEDEBUGINFO" ] = "yes"; else if (configCmdLine.at(i) == "-shared") dictionary[ "SHARED" ] = "yes"; @@ -1596,6 +1599,8 @@ bool Configure::displayHelp() desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on."); desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n"); + desc("FORCEDEBUGINFO", "yes","-force-debug-info", "Create symbol files for release builds.\n"); + desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt."); desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n"); @@ -2392,6 +2397,8 @@ void Configure::generateOutputVars() if (dictionary[ "BUILDALL" ] == "yes") { qtConfig += "build_all"; } + if (dictionary[ "FORCEDEBUGINFO" ] == "yes") + qtConfig += "force_debug_info"; qmakeConfig += dictionary[ "BUILD" ]; dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ]; @@ -3204,7 +3211,14 @@ void Configure::displayConfig() sout << "Host Architecture..........." << dictionary["QT_HOST_ARCH"] << ", features:" << dictionary["QT_HOST_CPU_FEATURES"] << endl; sout << "Maketool...................." << dictionary[ "MAKE" ] << endl; - sout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl; + if (dictionary[ "BUILDALL" ] == "yes") { + sout << "Debug build................." << "yes (combined)" << endl; + sout << "Default build..............." << dictionary[ "BUILD" ] << endl; + } else { + sout << "Debug......................." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl; + } + if (dictionary[ "BUILD" ] == "release" || dictionary[ "BUILDALL" ] == "yes") + sout << "Force debug info............" << dictionary[ "FORCEDEBUGINFO" ] << endl; sout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl; sout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl; sout << "RTTI support................" << dictionary[ "RTTI" ] << endl;