my-qt-crasher icon indicating copy to clipboard operation
my-qt-crasher copied to clipboard

😽🖥💥 Example MacOS, Windows, and Linux Qt application integrated with Crashpad.

bugsplat-github-banner-basic-outline

BugSplat

Crash and error reporting built for busy developers.

👋 Introduction

This sample demonstrates cross-platform crash reporting with BugSplat, Crashpad, and Qt. MyQtCrasher includes prebuilt versions of Crashpad for Windows, macOS (x86_64 and arm64), and Linux. Additionally, this sample demonstrates how to use the Breakpad tools dump_syms and symupload to create and upload .sym files as part of your Qt build.

For more information about how to configure Crashpad in your Qt application please see the BugSplat docs.

📋 Steps

  1. Download and install Qt Creator
  2. Open myQtCrasher.pro
  3. Build > Run to run without the debugger attached
  4. Click the button to generate a crash report
  5. Log into BugSplat using our public account [email protected] and the password Flintstone
  6. Click the link in the ID column on the Crashes page to see detailed information similar to what you would see in your debugger

Windows

When building your Qt project you may encounter Il mismatch between 'P1' version 'x' and 'P2' version 'y'. This is due to Qt building with a different toolchain than the Crashpad libraries. To workaround the Il mismatch issue, build Crashpad specifying /GL- for extra_cflags. When Crashpad is built with different minor versions of MSVC specifying /GL- usually fixes the problem. However, if the linker complains about unresolved symbols after specifying /GL- you will need to ensure you're building with the same major version of MSVC. The pre-built Crashpad libraries included in this sample are built with MSVC 17 (2022).

macOS

You will need to link with the correct libraries and load the correct version of crashpad_handler at runtime depending on if your build is targeting x86_64 or arm64 (M1) macOS systems. In myQtCrasher.pro there is an variable that you can uncomment that will allow you to build for arm64 macOS systems.

Attachments

BugSplat has created a Crashpad fork that adds support for attachments to macOS. This project uses pre-built binaries from the forked version of Crashpad to demonstrate attachment support on macOS. If attachment support on macOS is a requirement for your project, you can use the pre-built libraries from this repo, or build the Crashpad libraries yourself from the code in our forked repo.

Additional Considerations

If you change the database, application and version in main.cpp, be sure to update the QMAKE_POST_LINK command with these new values. symbols.sh is responsible for running dump_syms and symupload on macOS and Linux. symbols.bat is responsible for running symupload on Windows. If the values passed to symbols.sh or symbols.bat via the QMAKE_POST_LINK command are wrong then you will not see file names or line numbers in your crash reports.

👷 Support

If you have any additional questions, please email our support team, join us on Discord, or reach out via the chat in our web application.