This project is a demo implementation of sentry-native with Qt integration, the Sentry SDK for Native Crash Reporting. The demo produces a native crash that gets captured by sentry-native and sent to Sentry.io This demo uses sentry-native in its packaged release form - it is referenced as a submodule. You can also download it separately here https://github.com/getsentry/sentry-native as a distribution zip.
The Official Sentry Documentation for Qt is at https://docs.sentry.io/platforms/native/guides/qt
dependency | version |
---|---|
sentry-native | 0.4.11 |
sentry-cli | 1.66.0 |
Qt | 5.12.11 |
Xcode | 12.5.1 |
cmake | 3.20.5 |
macOS | Big Sur 11.4 |
cmake
brew install cmake
sentry-cli
yarn global add @sentry/cli
. You can also get it from https://github.com/getsentry/sentry-cli/releases/ or https://docs.sentry.io/cli/installation/
Qt
Follow this link https://www.qt.io/download, navigate to Go Open Source -> Download the Qt Online Installer -> Download
Note: for this demo these 2 components should suffice
Xcode
Qt depends on Xcode, follow this link to download Xcode https://developer.apple.com/xcode/
CMAKE_PREFIX_PATH="/path/to/Qt/5.12.11/clang_64/lib/cmake/Qt5"
sentry_DIR="/path/to/Qt-demo/sentry-native/install"
Note: the install path a.k.a sentry_DIR would be created upon running the bash script
Inside Qt-demo/Makefile modify the first 2 lines to your Sentry Organization Slug and Project Name respectivley. Both can be found in Sentry.io under Settings.
Inside Qt-demo/main.cpp modify sentry_options_set_dsn()
to your project's DSN key. You can also set enviroment and release if need be.
In sentry.io under Settings -> Integrations -> Github Install Github integrations and add your repository. More can be found on our Github Documentation
git clone --recurse-submodules https://github.com/dachakra/QT-demo.git
- Makefile adjustment
- Add enviroment variables
bash run.sh
The Qt app consists of 2 buttons:
Native Crash:
- Generates a segmentation fault which crashes the application
- Breadcrumbs:
- NativeCrashButton Pressed
- Setting user to John Doe
- Initalizing Memory
- Calls functuon
startup()
from eventCrashes.h
Sentry Event:
- Generates a custom sentry crash event
- Breadcrumbs:
- sentryCrashButton Pressed
- Configuring GPU Context
- Sentry Message Capture
- Calls function
send_event()
from eventCrashes.h
Note: You can add more breadcrumbs by using Qt Logger.
make
or make all
has several targets:
- Generate build directory of sentry SDK with options
SENTRY_INTEGRATION_QT=YES
andSENTRY_BACKEND=CRASHPAD
more can be found in Compile-time options - Build sentry SDK and crashpad handler
- Install the resulting artifacts into a specific prefix
- Generate and build the build directory for the Qt application
make setup_release
creates a Sentry Release and associates git commits
make upload_debug_files
uploads your symbols to Project Settings > Debug Files https://sentry.io/settings/${YOUR_ORG}/projects/${PROJECT}/debug-symbols/. You can also access your symbols from a Symbol Server https://docs.sentry.io/workflow/debug-files/#symbol-servers
run.sh
actions:
- creates bin directory
make all
- copies qt app to bin
make setup_release
make upload_debug_files
found in bin directory
This demo app was tested with sentry-native v0.4.11
git pull // gets latest code
git submodule update --init --recursive // updates the 'sentry-native' submodule
make bin/example // or make all. start building again, with the newer Release of sentry-native
--