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/handler/QBreakpadHandler.cpp b/handler/QBreakpadHandler.cpp index a68b7f9..03a8e0e 100644 --- a/handler/QBreakpadHandler.cpp +++ b/handler/QBreakpadHandler.cpp @@ -144,6 +144,11 @@ QString QBreakpadHandler::uploadUrl() const return d->uploadUrl.toString(); } +QString QBreakpadHandler::dumpPath() const +{ + return d->dumpPath; +} + QStringList QBreakpadHandler::dumpFileList() const { if(!d->dumpPath.isNull() && !d->dumpPath.isEmpty()) { 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 ---- diff --git a/third_party/breakpad.pri b/third_party/breakpad.pri index 3dd1c18..5e6fd9d 100644 --- a/third_party/breakpad.pri +++ b/third_party/breakpad.pri @@ -1,61 +1,62 @@ CONFIG += c++11 # internal file, used but breakpad-qt -BREAKPAD_PATH = $$PWD/breakpad/src -INCLUDEPATH += $$BREAKPAD_PATH $$PWD/../ +BREAKPAD_PATH = $$PWD/breakpad #for breakpad's third_patry(such as lss) +BREAKPAD_PATH_SRC = $$PWD/breakpad/src +INCLUDEPATH += $$BREAKPAD_PATH $$BREAKPAD_PATH_SRC # every *nix unix { SOURCES += \ - $$BREAKPAD_PATH/client/minidump_file_writer.cc \ - $$BREAKPAD_PATH/common/convert_UTF.cc \ - $$BREAKPAD_PATH/common/md5.cc \ - $$BREAKPAD_PATH/common/string_conversion.cc + $$BREAKPAD_PATH_SRC/client/minidump_file_writer.cc \ + $$BREAKPAD_PATH_SRC/common/convert_UTF.cc \ + $$BREAKPAD_PATH_SRC/common/md5.cc \ + $$BREAKPAD_PATH_SRC/common/string_conversion.cc } # mac os x mac { OBJECTIVE_SOURCES += \ - $$BREAKPAD_PATH/client/mac/crash_generation/crash_generation_client.cc \ - $$BREAKPAD_PATH/client/mac/handler/breakpad_nlist_64.cc \ - $$BREAKPAD_PATH/client/mac/handler/dynamic_images.cc \ - $$BREAKPAD_PATH/client/mac/handler/exception_handler.cc \ - $$BREAKPAD_PATH/client/mac/handler/minidump_generator.cc \ - $$BREAKPAD_PATH/common/mac/MachIPC.mm \ - $$BREAKPAD_PATH/common/mac/bootstrap_compat.cc \ - $$BREAKPAD_PATH/common/mac/file_id.cc \ - $$BREAKPAD_PATH/common/mac/macho_id.cc \ - $$BREAKPAD_PATH/common/mac/macho_utilities.cc \ - $$BREAKPAD_PATH/common/mac/macho_walker.cc \ - $$BREAKPAD_PATH/common/mac/string_utilities.cc + $$BREAKPAD_PATH_SRC/client/mac/crash_generation/crash_generation_client.cc \ + $$BREAKPAD_PATH_SRC/client/mac/handler/breakpad_nlist_64.cc \ + $$BREAKPAD_PATH_SRC/client/mac/handler/dynamic_images.cc \ + $$BREAKPAD_PATH_SRC/client/mac/handler/exception_handler.cc \ + $$BREAKPAD_PATH_SRC/client/mac/handler/minidump_generator.cc \ + $$BREAKPAD_PATH_SRC/common/mac/MachIPC.mm \ + $$BREAKPAD_PATH_SRC/common/mac/bootstrap_compat.cc \ + $$BREAKPAD_PATH_SRC/common/mac/file_id.cc \ + $$BREAKPAD_PATH_SRC/common/mac/macho_id.cc \ + $$BREAKPAD_PATH_SRC/common/mac/macho_utilities.cc \ + $$BREAKPAD_PATH_SRC/common/mac/macho_walker.cc \ + $$BREAKPAD_PATH_SRC/common/mac/string_utilities.cc } # other *nix unix:!mac { SOURCES += \ - $$BREAKPAD_PATH/client/linux/crash_generation/crash_generation_client.cc \ - $$BREAKPAD_PATH/client/linux/dump_writer_common/thread_info.cc \ - $$BREAKPAD_PATH/client/linux/dump_writer_common/ucontext_reader.cc \ - $$BREAKPAD_PATH/client/linux/handler/exception_handler.cc \ - $$BREAKPAD_PATH/client/linux/handler/minidump_descriptor.cc \ - $$BREAKPAD_PATH/client/linux/log/log.cc \ - $$BREAKPAD_PATH/client/linux/microdump_writer/microdump_writer.cc \ - $$BREAKPAD_PATH/client/linux/minidump_writer/linux_core_dumper.cc \ - $$BREAKPAD_PATH/client/linux/minidump_writer/linux_dumper.cc \ - $$BREAKPAD_PATH/client/linux/minidump_writer/linux_ptrace_dumper.cc \ - $$BREAKPAD_PATH/client/linux/minidump_writer/minidump_writer.cc \ - $$BREAKPAD_PATH/common/linux/breakpad_getcontext.S \ - $$BREAKPAD_PATH/common/linux/elfutils.cc \ - $$BREAKPAD_PATH/common/linux/file_id.cc \ - $$BREAKPAD_PATH/common/linux/guid_creator.cc \ - $$BREAKPAD_PATH/common/linux/linux_libc_support.cc \ - $$BREAKPAD_PATH/common/linux/memory_mapped_file.cc \ - $$BREAKPAD_PATH/common/linux/safe_readlink.cc + $$BREAKPAD_PATH_SRC/client/linux/crash_generation/crash_generation_client.cc \ + $$BREAKPAD_PATH_SRC/client/linux/dump_writer_common/thread_info.cc \ + $$BREAKPAD_PATH_SRC/client/linux/dump_writer_common/ucontext_reader.cc \ + $$BREAKPAD_PATH_SRC/client/linux/handler/exception_handler.cc \ + $$BREAKPAD_PATH_SRC/client/linux/handler/minidump_descriptor.cc \ + $$BREAKPAD_PATH_SRC/client/linux/log/log.cc \ + $$BREAKPAD_PATH_SRC/client/linux/microdump_writer/microdump_writer.cc \ + $$BREAKPAD_PATH_SRC/client/linux/minidump_writer/linux_core_dumper.cc \ + $$BREAKPAD_PATH_SRC/client/linux/minidump_writer/linux_dumper.cc \ + $$BREAKPAD_PATH_SRC/client/linux/minidump_writer/linux_ptrace_dumper.cc \ + $$BREAKPAD_PATH_SRC/client/linux/minidump_writer/minidump_writer.cc \ + $$BREAKPAD_PATH_SRC/common/linux/breakpad_getcontext.S \ + $$BREAKPAD_PATH_SRC/common/linux/elfutils.cc \ + $$BREAKPAD_PATH_SRC/common/linux/file_id.cc \ + $$BREAKPAD_PATH_SRC/common/linux/guid_creator.cc \ + $$BREAKPAD_PATH_SRC/common/linux/linux_libc_support.cc \ + $$BREAKPAD_PATH_SRC/common/linux/memory_mapped_file.cc \ + $$BREAKPAD_PATH_SRC/common/linux/safe_readlink.cc } win32 { SOURCES += \ - $$BREAKPAD_PATH/client/windows/crash_generation/crash_generation_client.cc \ - $$BREAKPAD_PATH/client/windows/handler/exception_handler.cc \ - $$BREAKPAD_PATH/common/windows/guid_string.cc + $$BREAKPAD_PATH_SRC/client/windows/crash_generation/crash_generation_client.cc \ + $$BREAKPAD_PATH_SRC/client/windows/handler/exception_handler.cc \ + $$BREAKPAD_PATH_SRC/common/windows/guid_string.cc }