diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b0b707 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +crashpad/tools/symbol-upload-linux filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index fa92cb7..1b6fa4a 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 + +myUbuntuCrasher crash on BugSplat ## 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. diff --git a/crashpad/tools/LICENSE b/crashpad/tools/LICENSE deleted file mode 100644 index 5ab8028..0000000 --- a/crashpad/tools/LICENSE +++ /dev/null @@ -1,108 +0,0 @@ -Copyright (c) 2006, Google Inc. -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------- -Copyright 2001-2004 Unicode, Inc. -Disclaimer -This source code is provided as is by Unicode, Inc. No claims are -made as to fitness for any particular purpose. No warranties of any -kind are expressed or implied. The recipient agrees to determine -applicability of information provided. If this file has been -purchased on magnetic or optical media from Unicode, Inc., the -sole remedy for any claim will be exchange of defective media -within 90 days of receipt. -Limitations on Rights to Redistribute This Code -Unicode, Inc. hereby grants the right to freely use the information -supplied in this file in the creation of products supporting the -Unicode Standard, and to make copies of this file in any form -for internal or external distribution as long as this notice -remains attached. --------------------------------------------------------------------- -libunwind - a platform-independent unwind library - Copyright (C) 2008 Google, Inc - Contributed by Paul Pluzhnikov - Copyright (C) 2010 Konstantin Belousov -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --------------------------------------------------------------------- -Copyright (c) 1999 Apple Computer, Inc. All rights reserved. -@APPLE_LICENSE_HEADER_START@ -This file contains Original Code and/or Modifications of Original Code -as defined in and that are subject to the Apple Public Source License -Version 2.0 (the 'License'). You may not use this file except in -compliance with the License. Please obtain a copy of the License at -http://www.opensource.apple.com/apsl/ and read it before using this -file. -The Original Code and all software distributed under the License are -distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, -INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. -Please see the License for the specific language governing rights and -limitations under the License. -@APPLE_LICENSE_HEADER_END@ --------------------------------------------------------------------- -Copyright (c) 1989, 1993 -The Regents of the University of California. All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by the University of - California, Berkeley and its contributors. -4. Neither the name of the University nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/crashpad/tools/dump_syms b/crashpad/tools/dump_syms deleted file mode 100755 index f0ec5d9..0000000 Binary files a/crashpad/tools/dump_syms and /dev/null differ diff --git a/crashpad/tools/sym_upload b/crashpad/tools/sym_upload deleted file mode 100755 index 572a0e4..0000000 Binary files a/crashpad/tools/sym_upload and /dev/null differ diff --git a/crashpad/tools/symbol-upload-linux b/crashpad/tools/symbol-upload-linux new file mode 100755 index 0000000..4dda9d0 --- /dev/null +++ b/crashpad/tools/symbol-upload-linux @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eaf70d2cc82aa89a3dd7301d91322e43d44c0f6ac1e8fa30e5b011dd7a712ab +size 133500032 diff --git a/scripts/exports.sh b/scripts/exports.sh index 6fcd32e..e4bbf23 100755 --- a/scripts/exports.sh +++ b/scripts/exports.sh @@ -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"} diff --git a/scripts/symbols.sh b/scripts/symbols.sh index 9ce7170..3d66526 100755 --- a/scripts/symbols.sh +++ b/scripts/symbols.sh @@ -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 +