-
-
Notifications
You must be signed in to change notification settings - Fork 17
Crashpad
Installing depot_tools (ref)
MacOS
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
sudo echo "export PATH=/path/to/depot_tools:$PATH" >> ~/.zshrc
Getting the Crashpad source (ref)
mkdir ~/crashpad
cd ~/crashpad
fetch crashpad
cd ~/crashpad/crashpad
git pull -r
gclient sync
cd ~/crashpad/crashpad
gn gen out/Default
ninja -C out/Default
Building Shared Libraries (ref)
Windows
After running gn gen out\Default
, you can edit the out\Default\toolchain.ninja
file to add extra compiler flags to the command for the cc and cxx rules.
rule cc
command = ninja -t msvc -e environment.amd64 -- cl.exe ... ${cflags} ${cflags_c} /c ...
add the /MD compiler flag after the others, here ^
MacOS
Building Crashpad outputs several .a files which need to be added to your project along with the corresponding include directories. In addition to the .a files Crashpad generates a collection of .o files that need to be included. You will also need to link with libbsm, Security.Framework and AppKit.Framework. Finally, you'll need to add config parameters force_debug_info and separate_debug_info.
# Create a dSYM file for dump_syms
CONFIG += force_debug_info
CONFIG += separate_debug_info
# Include directories for Crashpad libraries
# TODO BG copy to sample project
INCLUDEPATH += /Users/bobby/Desktop/bugsplat/crashpad/crashpad
INCLUDEPATH += /Users/bobby/Desktop/bugsplat/crashpad/crashpad/third_party/mini_chromium/mini_chromium
# Crashpad libraries
# TODO BG copy to sample project
LIBS += -L/Users/bobby/Desktop/bugsplat/crashpad/crashpad/out/Default/obj/third_party/mini_chromium/mini_chromium/base/ -lbase
LIBS += -L/Users/bobby/Desktop/bugsplat/crashpad/crashpad/out/Default/obj/util/ -lutil
LIBS += -L/Users/bobby/Desktop/bugsplat/crashpad/crashpad/out/Default/obj/client/ -lclient
LIBS += "/Users/bobby/Desktop/bugsplat/crashpad/crashpad/out/Default/obj/out/Default/gen/util/mach/*.o"
# System libraries
LIBS += -L/usr/lib/ -lbsm
LIBS += -framework AppKit
LIBS += -framework Security
Ensure your project builds before moving on to the next step.
The Crashpad repository is missing a few tools that are available in the Breakpad repository. In order to generate sym files from your compiled executable you'll need to clone the Breakpad repository and build the dump_syms utility.
mkdir ~/breakpad
cd ~/breakpad
fetch breakpad
MacOS
Open breakpad/src/src/tools/mac/dump_syms/dump_syms.xcodeproj
. Switch the configuration to dump_syms and build the project. The report navigator tab (icon looks like a chat bubble in Xcode 11) will show you the file system location with the compiled executable. Copy the dump_syms executable into your project.
- `./dump_syms -g path/to/app.dSYM path/to/app > app.sym
MacOS
Open breakpad/src/src/tools/mac/sym_upload/sym_upload.xcodeproj
and build the project. The report navigator tab (icon looks like a chat bubble in Xcode 11) will show you the file system location with the compiled executable. Copy the sym_upload executable into your project.
If your application generates large sym file sizes, or your network bandwidth is limited you may run into upload timeouts. If this happens, increase the value of
timeoutInterval
inbreakpad/src/src/common/mac/HTTPMultipartUpload.m
.