Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReleaseBuild & Tips #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)**.
5 changes: 5 additions & 0 deletions handler/QBreakpadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
41 changes: 41 additions & 0 deletions qBreakpad.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----
79 changes: 40 additions & 39 deletions third_party/breakpad.pri
Original file line number Diff line number Diff line change
@@ -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
}