From b4133b502f73234da2a089b6339ed08ca67b8a48 Mon Sep 17 00:00:00 2001 From: LiaoCheng <820564830@qq.com> Date: Sat, 4 Jun 2022 13:36:23 +0800 Subject: [PATCH] 1 qBreakpad.pri: Add A typical configuration of adding debug information in release build 2 README.md: Modify and add some tips on building and decoding dumps --- README.md | 14 +++++++++++++- qBreakpad.pri | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 98433b6..d5d9e5e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ qBreakpad is Qt library to use google-breakpad crash reporting facilities (and using it conviniently). Supports -* Windows (but crash dump decoding will not work with MinGW compiler) +* Windows * Linux * MacOS X @@ -41,4 +41,16 @@ Getting started with Google Breakpad ---------------- https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/getting_started_with_breakpad.md +Tips of building and dump's decoding +---------------- +* MinGW: +You can try to use the tool **cv2pdb**(https://github.com/rainers/cv2pdb), to strip the debug information from the binary and generate the pdb file, +then use Visual Studio to decode the dump conveniently. +* Linux: +You can use the tool **minidump-2-core** of Google Breakpad, to convert the dump file to core file, then use QtCreator to decode the dump conveniently. +* Mac: +Refer to qBreakpad's Wiki + +Wiki +---------------- Detail description about integration `qBreakpad` into your system and platform you could find in **[Wiki](https://github.com/buzzySmile/qBreakpad/wiki)**. diff --git a/qBreakpad.pri b/qBreakpad.pri index 612e121..b2f1137 100644 --- a/qBreakpad.pri +++ b/qBreakpad.pri @@ -8,3 +8,44 @@ HEADERS += \ LIBS += \ -L$$PWD/handler -lqBreakpad + +# ---- A typical configuration of adding debug information in release build ---- +# Test environment: +# Windows: qt5.6.2 mingw4.9.2-32bit and qt5.6.2 msvc2015-32bit +# Linux: qt5.6.2 gcc5.3.1 +# Mac: do not test + +*-g++ { +#message($$QMAKE_CXXFLAGS_DEBUG) # => -g +#message($$QMAKE_CXXFLAGS_RELEASE) # => -O2 +#message($$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO) # => -O2 -g +#message($$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO) # => linux: -O2 -g; mingw: nothing +#message($$QMAKE_LFLAGS_DEBUG) # => nothing +#message($$QMAKE_LFLAGS_RELEASE) # => linux: -Wl,-O1; mingw: -Wl,-s + +# Add debug information, delete compilation optimization +QMAKE_CFLAGS_RELEASE += -g # QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO is '-O2 -g', but don't add '-O2' +QMAKE_CFLAGS_RELEASE -= -O2 +QMAKE_CXXFLAGS_RELEASE += -g # QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO +QMAKE_CXXFLAGS_RELEASE -= -O2 + +QMAKE_LFLAGS_RELEASE -= -Wl,-s # Delete the default parameter '-Wl,-s'(delete debug information in linkingŁ© +#QMAKE_LFLAGS_RELEASE -= -Wl,-O1 # In linking's -O1, only -fmerge-constants valid, but it don't affect debug info. So don't delete -O1 +} +else { +#message($$QMAKE_CXXFLAGS_DEBUG) # => -Zi -MDd +#message($$QMAKE_CXXFLAGS_RELEASE) # => -O2 -MD +#message($$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO) # => -O2 -Zi -MD +#message($$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO) # => -O2 -Zi -MD +#message($$QMAKE_LFLAGS_DEBUG) # => nothing +#message($$QMAKE_LFLAGS_RELEASE) # => /INCREMENTAL:NO + +# Add debug information, delete compilation optimization +QMAKE_CFLAGS_RELEASE += -Zi /Od +QMAKE_CFLAGS_RELEASE -= -O2 +QMAKE_CXXFLAGS_RELEASE += -Zi /Od +QMAKE_CXXFLAGS_RELEASE -= -O2 + +QMAKE_LFLAGS_RELEASE += /DEBUG # This disable /INCREMENTAL:NO implicitly +} +# ---- A typical configuration of adding debug information in release build ----