Skip to content

Commit

Permalink
Merge #1174 from ElucidataInc/fix_crash_reports
Browse files Browse the repository at this point in the history
Fix crash reports
  • Loading branch information
saifulbkhan authored Nov 29, 2019
2 parents 46ef272 + f532f6d commit 944d3bb
Show file tree
Hide file tree
Showing 12 changed files with 775 additions and 137 deletions.
35 changes: 18 additions & 17 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ environment:
SENTRY_KEYS:
secure: 4h/RDAT2VRFeFncyVmupjvYW2+ZVLLt8Meb0HZnKpeXw4DgSXxy2C8PicOvkBrxGsywvi1LTBDAJdTBdCaXHXETB0zLjFrasYj9hNUYhF2hWF7XZXA9qYPyhZHNVyg8t
SENTRY_OAUTH:
secure: +59H0p7EcOrHb6126nylf5sN7HF40cJMNa1skgWKDJNK6YZStg+agGdsX8cfqC5QBVMTK8ir/S3W1X35r4ElsgadQD54Zr8y0jvfyKN5hAw=
secure: 27P9bk8UQd9PDKzjLCfy1usKSpt+46f8RYs/cNaPxWS3CBksealddVYAA26iGLvog4AE0kLS/jUYAysDZ3yWQsGzRv8sCjC7S8imHwoDpWY=
CODECOV_TOKEN:
secure: kDB13lf6yyaC7d63D0DcRbEjf5vZ77xt2WMxHtxx7Jz32OUaR8Ouxso7WBQoubMO
AWS_ACCESS_KEY:
Expand Down Expand Up @@ -43,7 +43,7 @@ install:

build_script:
# write to Sentry keys file
- echo "$env:SENTRY_KEYS`n" >> keys
- ps: echo $env:SENTRY_KEYS | out-file -encoding ASCII keys

- ps: |
# check for Sentry keys file
Expand Down Expand Up @@ -168,21 +168,22 @@ after_build:
# strip and upload debug symbols
echo "Stripping and uploading symbols ..."
cd $BIN
$BREAKPAD_TOOLS = "$env:APPVEYOR_BUILD_FOLDER\$env:PACKAGING_REPO\breakpad_tools\windows"
$exe_file = "$env:APPNAME.exe"
$pdb_file = "$env:APPNAME.pdb"
$symbol_file = "$env:APPNAME.sym"
& "$BREAKPAD_TOOLS\cv2pdb.exe" $exe_file
& "$BREAKPAD_TOOLS\dump_syms.exe" $pdb_file > $symbol_file
$uuid = $( gc $symbol_file | select -first 1 | grep -o -P "(?<=x86_64).*(?=$pdb_file)" | xargs )
mkdir -p ..\symbols\"$env:APPNAME.pdb"\$uuid\
mv $symbol_file ..\symbols\"$env:APPNAME.pdb"\$uuid\
chmod +x $BREAKPAD_TOOLS\sentry-cli.exe
& "$BREAKPAD_TOOLS\sentry-cli.exe" --auth-token $env:SENTRY_OAUTH upload-dif -t breakpad --project el-maven-logging --org el-maven ../symbols/
rm "$env:APPNAME.pdb"
$WIN_BREAKPAD_TOOLS = "$env:APPVEYOR_BUILD_FOLDER\$env:PACKAGING_REPO\breakpad_tools\windows"
# convert Windows paths to Unix style paths
$BREAKPAD_TOOLS = (($WIN_BREAKPAD_TOOLS -replace "\\","/") -replace ":","").ToLower().Trim("/")
$EXE_DIR = (($BIN -replace "\\","/") -replace ":","").ToLower().Trim("/")
# need to perform symbol creation within bash environment otherwise they are not recognized
$APPNAME = $env:APPNAME ; bash -lc "/$BREAKPAD_TOOLS/cv2pdb.exe /$EXE_DIR/$APPNAME.exe"
$APPNAME = $env:APPNAME ; bash -lc "/$BREAKPAD_TOOLS/dump_syms.exe /$EXE_DIR/$APPNAME.pdb > /$EXE_DIR/$APPNAME.sym"
chmod +x $WIN_BREAKPAD_TOOLS\sentry-cli.exe
ls
& "$WIN_BREAKPAD_TOOLS\sentry-cli.exe" difutil check .\$APPNAME.sym
& "$WIN_BREAKPAD_TOOLS\sentry-cli.exe" --auth-token $env:SENTRY_OAUTH upload-dif -t breakpad --project el-maven-logging --org el-maven --wait --include-sources .\$APPNAME.sym
rm .\$APPNAME.pdb
rm .\$APPNAME.sym
# copy node
echo "Copying node requirements ..."
Expand Down
51 changes: 29 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ install:
curl -O https://raw.githubusercontent.com/Homebrew/homebrew-core/65a45a9e61f15046a256cdba6a008f38f79570c9/Formula/qt.rb
brew install ./qt.rb
brew link qt5 --force;
# compile sentry-native binaries and libraries only if we are building an installer
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
curl -O -J -L https://github.com/getsentry/sentry-native/releases/download/0.1.2/sentry-native-0.1.2.zip
unzip sentry-native-0.1.2.zip &> /dev/null
cd sentry-native/gen_macosx
make -j4 config=release sentry_crashpad
export SENTRY_MACOSX_BIN="$PWD/bin/Release"
cd -
fi
fi
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
Expand All @@ -55,16 +65,6 @@ install:
fi
script:
# write to Sentry keys file
- printf "%s\n\n" $SENTRY_KEYS > keys

- |
# check for Sentry keys file
if [ ! -f keys ]; then
echo "File not found - 'keys', needed for crash reporter to work properly."
exit 1
fi
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export LDFLAGS="-L/usr/local/opt/llvm@6/lib -Wl,-rpath,/usr/local/opt/llvm@6/lib"
Expand All @@ -76,7 +76,14 @@ script:
make -j4;
./run_tests.sh;
else
qmake CONFIG+=release CONFIG+=force_debug_info NOTESTS=yes
# to export the path to sentry-native dynamic library
export PATH="$SENTRY_MACOSX_BIN:$PATH"
export LDFLAGS="$LDFLAGS -L/$SENTRY_MACOSX_BIN"
# export private DSN as base64 encoded string (helps with stringification)
export SENTRY_DSN_BASE64=`echo $SENTRY_DSN | base64`
qmake CONFIG+=release CONFIG+=force_debug_info CONFIG+=separate_debug_info NOTESTS=yes
make -j4;
fi
fi
Expand Down Expand Up @@ -152,23 +159,23 @@ after_success:
rsync -av --progress --exclude={'windows', 'linux', 'node', 'node_bin', 'node.exe', 'MavenTests'} $ELMAVEN_BIN . &>/dev/null
# prepare dSYM files
echo "Preparing debug symbol files ..."
dsymutil "El-MAVEN.app/Contents/MacOS/El-MAVEN" -o "El-MAVEN.dSYM" &>/dev/null
macdeployqt El-MAVEN.app &>/dev/null
macdeployqt peakdetector.app &>/dev/null
macdeployqt crashreporter.app &>/dev/null
# install_name_tool -add_rpath @executable_path/../Frameworks "El-MAVEN.app/Contents/MacOS/crashserver"
# create application bundles for both binaries
echo "Deploying bundles ..."
cp "$SENTRY_MACOSX_BIN/crashpad_handler" "El-MAVEN.app/Contents/MacOS/"
macdeployqt El-MAVEN.app
macdeployqt peakdetector.app
cp "$SENTRY_MACOSX_BIN/libsentry_crashpad.dylib" "El-MAVEN.app/Contents/Frameworks/"
install_name_tool -change @rpath/libsentry_crashpad.dylib @executable_path/../Frameworks/libsentry_crashpad.dylib "El-MAVEN.app/Contents/MacOS/El-MAVEN"
if [ $? != 0 ]; then
echo "Failed to create debug files."
echo "Failed to create application bundles."
exit 1
fi
# strip and upload debug symbols
echo "Stripping and uploading symbols ..."
# upload debug symbols
echo "Uploading debug symbols for El-MAVEN ..."
cd $BIN
$BREAKPAD_TOOLS/mac/strip_symbols.sh $BREAKPAD_TOOLS "El-MAVEN.app/Contents/MacOS/El-MAVEN" El-MAVEN &>/dev/null
$BREAKPAD_TOOLS/mac/sentry-cli --auth-token $SENTRY_AUTH upload-dif --project el-maven-logging --org el-maven --include-sources --wait El-MAVEN.app.dSYM/Contents/Resources/DWARF/
rm -r *.dSYM
# copy node
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ in the .bashrc file. It can be achieved by either manually editing the .bashrc f
- `sudo apt-get install qt5-qmake qtbase5-dev qtscript5-dev qtdeclarative5-dev libqt5multimedia5`
- `sudo apt-get install libqt5multimedia5-plugins qtmultimedia5-dev libqt5webkit5-dev`

3. ##### Mac
3. ##### MacOS

- Install Xcode from App store

Expand Down Expand Up @@ -111,6 +111,30 @@ in the .bashrc file. It can be achieved by either manually editing the .bashrc f

- `source .bash_profile`

---

Additionally, for MacOS, if building in release mode, sentry-native (Crashpad backend) should be compiled and available through the build environment. In a separate location, download the latest release, unzip and compile:

curl -O -J -L https://github.com/getsentry/sentry-native/releases/download/0.1.2/sentry-native-0.1.2.zip
unzip sentry-native-0.1.2.zip &> /dev/null
cd sentry-native/gen_macosx
make config=release sentry_crashpad
echo "export SENTRY_MACOSX_BIN='$PWD/bin/Release'" >> ~/.bash_profile
cd -

Once this has been done the path to sentry-native binaries and libraries should be exported in the user's enviroment:

echo "export PATH='$SENTRY_MACOSX_BIN:$PATH'" >> ~/.bash_profile
echo "export LDFLAGS='$LDFLAGS -L/$SENTRY_MACOSX_BIN'" >> ~/.bash_profile
source ~/.bash_profile

While the above set-up will allow compilation and linking in release mode without any errors, the crash reporting itself will not be functional until a unique Sentry DSN value is exported and available as a base64-encoded string _before_ platform config (qmake) step.

export SENTRY_DSN=<YOUR_SECRECT_SENTRY_DSN>
export SENTRY_DSN_BASE64=`echo $SENTRY_DSN | base64`

---

_To make sure the environment has ben setup correctly make sure the correct version of libraries have been installed by issuing the following commands_
- Qt version should be >= 5.7: `qmake -v`
- Boost should be >= 1.58
Expand Down
8 changes: 7 additions & 1 deletion build.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ include($$mac_compiler)

TEMPLATE = subdirs
CONFIG += ordered qt thread
SUBDIRS += 3rdparty crashhandler src
SUBDIRS += 3rdparty
win32 {
CONFIG(release, debug|release) {
SUBDIRS += crashhandler
}
}
SUBDIRS += src

!equals(NOTESTS, "yes"): SUBDIRS+=tests/MavenTests
146 changes: 66 additions & 80 deletions crashhandler/crashreporter/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>415</height>
<width>480</width>
<height>240</height>
</rect>
</property>
<property name="maximumSize">
Expand Down Expand Up @@ -37,88 +37,74 @@
<property name="title">
<string/>
</property>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>12</x>
<y>33</y>
<width>521</width>
<height>221</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;El-MAVEN&lt;/span&gt; has encountered a problem and needs to close. We are sorry for the inconvenience.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;We have created an error report that you can send to us.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;This report does not contain your input files or any other personally identifiable information&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>501</width>
<height>61</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>Don't send</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reportRestart">
<property name="text">
<string>Send report</string>
</property>
</widget>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.SF NS Text'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;El-MAVEN has encountered a problem and needs to close. We are sorry for the inconvenience. An error report has been created that you can send to us. It will help us in diagnosing your issue.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;This report does not contain your input files or any other personally identifiable information&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
<string>Don't send</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reportRestart">
<property name="text">
<string>Send report</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>586</width>
<height>26</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
Expand Down
2 changes: 1 addition & 1 deletion info.pri
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VER=$$system(git describe --tag)
DEFINES += "APPVERSION=$$VER"
DEFINES += "APPNAME=ElMaven"
DEFINES += "APPNAME=El-MAVEN"
4 changes: 4 additions & 0 deletions mzroll.pri
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ QT += sql core xml gui
CONFIG += silent exceptions
DEFINES += ZLIB BOOST_IOSTREAMS_NO_LIB

CONFIG(debug, debug|release) {
DEFINES += "DEBUG=1"
}

# this is important. Used in mzUtils to make use of correct mkdir function
win32 {
message("using win32 config")
Expand Down
11 changes: 9 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ flag=100 #this flag check wether qt running in debug mode or not
while true; do
read -p "Do you wish to install this program in release mode? " yn
case $yn in
[Yy]* ) qmake CONFIG+=release -o Makefile build.pro; break;;
[Nn]* ) qmake CONFIG+=debug -o Makefile build.pro; flag=10; break;;
[Yy]* )
qmake CONFIG+=release -o Makefile build.pro;
if [[ "$OSTYPE" == "darwin"* ]]; then
install_name_tool -change @rpath/libsentry_crashpad.dylib $SENTRY_MACOSX_BIN/libsentry_crashpad.dylib bin/El-MAVEN.app/Contents/MacOS/El-MAVEN;
cp $SENTRY_MACOSX_BIN/crashpad_handler bin/El-MAVEN.app/Contents/MacOS/;
fi
break;;
[Nn]* )
qmake CONFIG+=debug -o Makefile build.pro; flag=10; break;;
* ) echo "Please answer yes or no.";;
esac
done
Expand Down
Loading

0 comments on commit 944d3bb

Please sign in to comment.