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

Add qBreakpad for crash reporting #145

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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions app/about_ui/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ AboutDialog::~AboutDialog() {
}

void AboutDialog::show_changelog() {
int a;
a = 0;
*(int*)0 = a;
qDebug() << a;

QFile file(":/CHANGELOG.md");
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "error opening changelog resource file";
Expand Down
2 changes: 2 additions & 0 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ LIBS += \
-L../libs/qhotkey -lqhotkey

include(../libs/qhotkey/qhotkey.pri)

include(../libs/qBreakpad/qBreakpad.pri)
# End of libraries

unix: {
Expand Down
4 changes: 4 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "config/global.h"
#include "config/local.h"

#include <QBreakpadHandler.h>

#include <QApplication>
#include <QDebug>
#include <QTranslator>
Expand Down Expand Up @@ -50,6 +52,8 @@ int ipc_port(Config::Global &global_conf) {
}

int main(int argc, char *argv[]) {
QBreakpadInstance.setDumpPath(QLatin1String("/tmp/mpz_crashes"));

registerMetaTypes();
RNJesus::seed();

Expand Down
34 changes: 34 additions & 0 deletions libs/qBreakpad/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib
*.lib

# Qt-es
*.qmake.cache
*.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
qrc_*.cpp
ui_*.h
Makefile*
*-build-*
*.orig

# QtCreator
*.autosave

# other
*.DS_Store
*.dmp
*.bak
docs/html/
20 changes: 20 additions & 0 deletions libs/qBreakpad/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: cpp
compiler: gcc

dist: trusty
sudo: required

before_install:
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq

install:
- sudo apt-get install -y --force-yes build-essential g++-4.8 -y
- sudo apt-get install -y --force-yes libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev -y
- sudo apt-get install -y --force-yes qtbase5-dev qtdeclarative5-dev libqt5gui5 qttools5-dev-tools qttools5-dev qtmultimedia5-dev

script:
- qmake -qt=qt5 qBreakpad.pro
- make
- make check
11 changes: 11 additions & 0 deletions libs/qBreakpad/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Breakpad-qt AUTHORS
-------------

Aleksey Palazhchenko <[email protected]>
* Initial author of Breakpad-qt.

Sergey Shambir
* Contrubutor(build fixes), maintaner of Breakpad-qt.

Alexander Makarov <[email protected]>
* Contrubutor(migrate to official google-breakpad, refactoring), maintaner of Breakpad-qt.
5 changes: 5 additions & 0 deletions libs/qBreakpad/CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Breakpad-qt 0.4.0 (May 13, 2016)
-------------------------

- Improve thread-safety for QBreakpadHandler
- Clean useles functions of QBreakpadHandler
165 changes: 165 additions & 0 deletions libs/qBreakpad/LICENSE.LGPL
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
44 changes: 44 additions & 0 deletions libs/qBreakpad/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#qBreakpad

[![Build status](https://travis-ci.org/buzzySmile/qBreakpad.svg?branch=master)](https://travis-ci.org/buzzySmile/qBreakpad)

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)
* Linux
* MacOS X

How to use
----------------
* Clone repository recursively
```bash
$ git clone --recursive https://github.com/buzzySmile/qBreakpad.git
```
* Build qBreakpad static library (qBreakpad/handler/)
* Include "qBreakpad.pri" to your target Qt project
```c++
include($$PWD/{PATH_TO_QBREAKPAD}/qBreakpad.pri)
```
* Setup linking with "qBreakpad" library
```c++
QMAKE_LIBDIR += $$PWD/{PATH_TO_QBREAKPAD}/handler
LIBS += -lqBreakpad
```
* Use ```QBreakpadHandler``` singleton class to enable automatic crash dumps generation on any failure; example:
```c++
#include <QBreakpadHandler.h>

int main(int argc, char* argv[])
{
...
QBreakpadInstance.setDumpPath(QLatin1String("crashes"));
...
}
```
* Read Google Breakpad documentation to know further workflow

Getting started with Google Breakpad
----------------
https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/getting_started_with_breakpad.md

Detail description about integration `qBreakpad` into your system and platform you could find in **[Wiki](https://github.com/buzzySmile/qBreakpad/wiki)**.
27 changes: 27 additions & 0 deletions libs/qBreakpad/TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Handler:
- minidump on demand
- crash-friendly start of reporter external program
- do we really need 'thread, exception, rtti' ?
- to check everything with non-latin1 dir and file names - QFile::encodeName

Sender:
- to get information about environment (OS, hardware, software versions, etc.)
- to get information about crashed program (version, ...)
- send minidump with above-mentioned information and user's comment

google-breakpad:
- *nix: Does it support debugging symbols which was stripped to other file? (libA.so and libA.so.debug)
- GNU/Linux: Add support for DWARF symbols.

Build:
- 'make test'
- 'make install' - needed?

Demo:
- GUI for search in minidump (for sensitive data like passwords); highlight words 'password', 'login', etc.

Docs:
- "What do you expect to have in debug/release build?"
- debugging symbols
- special debugging code (#ifndef NDEBUG)
- linking with debug versions of libraries
18 changes: 18 additions & 0 deletions libs/qBreakpad/config.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CONFIG += static

macx {
CONFIG += c++11
LIBS += -lcrypto
}

# test config
# TODO actually, I shoud check it better
LIST = thread exceptions rtti stl
for(f, LIST) {
!CONFIG($$f) {
warning("Add '$$f' to CONFIG, or you will find yourself in 'funny' problems.")
}
}

# define breakpad server SOCORRO / CALIPER
DEFINES += CALIPER
2 changes: 2 additions & 0 deletions libs/qBreakpad/demo/demo.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TEMPLATE = subdirs
SUBDIRS = program reporter
Loading