Skip to content

Commit

Permalink
chore: replace dump_syms and symupload with @bugsplat/symbol-upload (#8)
Browse files Browse the repository at this point in the history
* chore: replace dump_syms and symupload with @bugsplat/symbol-upload

* chore: update README.md
  • Loading branch information
bobbyg603 authored Jul 9, 2024
1 parent d5f3396 commit be3f36a
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 124 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crashpad/tools/symbol-upload-linux filter=lfs diff=lfs merge=lfs -text
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

## Introduction 👋

This sample demonstrates Linux C++ crash reporting with [BugSplat](https://bugsplat.com) and [Crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md). The `my-ubuntu-crasher` sample includes a [prebuilt version](https://github.com/BugSplat-Git/my-ubuntu-crasher/tree/main/crashpad/lib) of Crashpad as well as the [Breakpad](https://chromium.googlesource.com/breakpad/breakpad/) tools dump_syms and symupload.
This sample demonstrates Linux C++ crash reporting with [BugSplat](https://bugsplat.com) and [Crashpad](https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md). The `my-ubuntu-crasher` sample includes a [prebuilt version](https://github.com/BugSplat-Git/my-ubuntu-crasher/tree/main/crashpad/lib) of Crashpad and [symbol-upload](https://github.com/BugSPlat-Git/symbol-upload) to create `.sym` files and upload them to BugSplat.

## Steps 🥾

1. Ensure git, python, llvm and clang are installed on your machine
1. Ensure git, python, llvm, and clang are installed on your machine
2. Clone this repository
3. Build main.cpp with debug information and a build ID and link the Crashpad libraries using clang

Expand All @@ -35,23 +35,34 @@ clang++ -pthread $PROJECT_DIR/main.cpp \
-Wl,--build-id
```

4. Generate .sym files for the output executable
4. Generate and upload symbols to BugSplat using symbol-upload and the `--dumpSyms` flag

```bash
export SYM_FILE=$OUT_DIR/$MODULE_NAME.sym
$CRASHPAD_DIR/tools/dump_syms $PROJECT_DIR/out/$MODULE_NAME > $SYM_FILE
$CRASHPAD_DIR/tools/symbol-upload-linux -b $BUGSPLAT_DATABASE \
-a $BUGSPLAT_APP_NAME \
-v $BUGSPLAT_APP_VERSION \
-u $BUGSPLAT_EMAIL \
-p $BUGSPLAT_PASSWORD \
-d $PROJECT_DIR/out \
-f $MODULE_NAME \
--dumpSyms
```
5. Upload the generated .sym file to BugSplat

5. Run the output executable to generate a crash report

```bash
export SYM_FILE=$OUT_DIR/$MODULE_NAME.sym
$CRASHPAD_DIR/tools/symupload $SYM_FILE "https://$BUGSPLAT_DATABASE.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName=$BUGSPLAT_APP_NAME&appVer=$BUGSPLAT_APP_VERSION"
./out/myUbuntuCrasher

# [10939:10939:20240705,155021.774184:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
# [10939:10939:20240705,155021.774253:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
# Segmentation fault
```

6. Run the output executable to generate a crash report
7. Log into BugSplat using our public account fred@bugsplat.com and password Flintstone
8. Navigate to the Crashes page and click the link in the ID column to see a detailed crash report
7. Log into [BugSplat](https://bugsplat.com) using our public account `fred@bugsplat.com` and password `Flintstone`
8. Navigate to the [Crashes]([https://app.bugsplat.com/v2/crashes](https://app.bugsplat.com/v2/crashes?c0=appName&f0=CONTAINS&v0=myUbuntuCrasher&database=Fred)) page and click the link in the ID column to see a detailed crash report

<img width="1728" alt="myUbuntuCrasher crash on BugSplat" src="https://github.com/BugSplat-Git/my-ubuntu-crasher/assets/2646053/07c97d9c-29ea-486b-808e-785a6fc2597d">

## Other ℹ️

Make sure that every time you build you increment the version number and generate/upload new symbol files. If you fail to generate and upload symbol files your crash reports will not contain file names and source line numbers.
Please ensure that you increment the version number every time you build and generate/upload new symbol files. If you fail to create and upload symbol files, your crash reports will not contain file names and source line numbers.
108 changes: 0 additions & 108 deletions crashpad/tools/LICENSE

This file was deleted.

Binary file removed crashpad/tools/dump_syms
Binary file not shown.
Binary file removed crashpad/tools/sym_upload
Binary file not shown.
3 changes: 3 additions & 0 deletions crashpad/tools/symbol-upload-linux
Git LFS file not shown
4 changes: 3 additions & 1 deletion scripts/exports.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
export CRASHPAD_CHECKOUT_DIR=${CRASHPAD_CHECKOUT_DIR:-"$HOME/Desktop/github/crashpad"}
export CRASHPAD_BUILD_DIR=${CRASHPAD_BUILD_DIR:-"$CRASHPAD_CHECKOUT_DIR/out/Default"}
export PROJECT_DIR=${PROJECT_DIR:-"$HOME/Desktop/github/my-ubuntu-crasher"}
export PROJECT_DIR=${PROJECT_DIR:-"/root/github/my-ubuntu-crasher/"}
export CRASHPAD_DIR=${CRASHPAD_DIR:-"$PROJECT_DIR/crashpad"}
export OUT_DIR=${OUT_DIR:-"$PROJECT_DIR/out"}
export MODULE_NAME=${MODULE_NAME:-"myUbuntuCrasher"}
export BUGSPLAT_EMAIL=${BUGSPLAT_EMAIL:-"fred@bugsplat.com"}
export BUGSPLAT_PASSWORD=${BUGSPLAT_PASSWORD:-"Flintstone"}
export BUGSPLAT_DATABASE=${BUGSPLAT_DATABASE:-"fred"}
export BUGSPLAT_APP_NAME=${BUGSPLAT_APP_NAME:-"myUbuntuCrasher"}
export BUGSPLAT_APP_VERSION=${BUGSPLAT_APP_VERSION:-"1.0.0"}
12 changes: 9 additions & 3 deletions scripts/symbols.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/bin/bash
source exports.sh
export SYM_FILE=$OUT_DIR/$MODULE_NAME.sym

$CRASHPAD_DIR/tools/dump_syms $PROJECT_DIR/out/$MODULE_NAME > $SYM_FILE
$CRASHPAD_DIR/tools/sym_upload $SYM_FILE "https://$BUGSPLAT_DATABASE.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName=$BUGSPLAT_APP_NAME&appVer=$BUGSPLAT_APP_VERSION"
$CRASHPAD_DIR/tools/symbol-upload-linux -b $BUGSPLAT_DATABASE \
-a $BUGSPLAT_APP_NAME \
-v $BUGSPLAT_APP_VERSION \
-u $BUGSPLAT_EMAIL \
-p $BUGSPLAT_PASSWORD \
-d $PROJECT_DIR/out \
-f $MODULE_NAME \
--dumpSyms

0 comments on commit be3f36a

Please sign in to comment.