2

I am trying to integrate Crashpad into Qt application on Linux. I am using Bugsplat database for testing and I followed this tutorial and managed to build this "dummy" application, which should serve as an example of using Qt with Crashpad.

I have made minor adjustments of files to fix build for my Linux platform, primarily making change of version easier and fixed creating directory & crashpad files next to application binaries.

All of the changes are listed below as a diff file:

diff --git a/Crashpad/Tools/Linux/symbols.sh b/Crashpad/Tools/Linux/symbols.sh
index 095f295..b065438 100644
--- a/Crashpad/Tools/Linux/symbols.sh
+++ b/Crashpad/Tools/Linux/symbols.sh
@@ -3,6 +3,6 @@ symupload="${1}/Crashpad/Tools/Linux/symupload"
 app="${2}/${4}.debug"
 sym="${4}.sym"
 url="https://${3}.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName=${4}&appVer=${5}"
-
+echo ${url}
 eval "${dump_syms} ${app} > ${sym}"
 eval $"${symupload} \"${sym}\" \"${url}\""
diff --git a/main.cpp b/main.cpp
index db97dd4..b721dc5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -26,7 +26,7 @@ int main(int argc, char *argv[])
 {
     QString dbName = "Fred";
     QString appName = "myQtCrasher";
-    QString appVersion = "1.0";
+    QString appVersion = QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION);
 
     initializeCrashpad(dbName, appName, appVersion);
 
diff --git a/myQtCrasher.pro b/myQtCrasher.pro
index 3005e41..3bf7a3e 100644
--- a/myQtCrasher.pro
+++ b/myQtCrasher.pro
@@ -15,6 +15,12 @@ DEFINES += QT_DEPRECATED_WARNINGS
 # You can also select to disable deprecated APIs only up to a certain version of Qt.
 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
 
+MAJOR_VERSION = 4
+MINOR_VERSION = 9
+
+DEFINES += MAJOR_VERSION=$$MAJOR_VERSION
+DEFINES += MINOR_VERSION=$$MINOR_VERSION
+
 SOURCES += \
     main.cpp \
     mainwindow.cpp \
@@ -94,7 +100,8 @@ linux {
     LIBS += -L$$PWD/Crashpad/Libraries/Linux/ -lbase
 
     # Copy crashpad_handler to build directory and run dump_syms and symupload
-    QMAKE_POST_LINK += "cp $$PWD/Crashpad/Bin/Linux/crashpad_handler $$OUT_PWD/crashpad"
-    QMAKE_POST_LINK += "&& bash $$PWD/Crashpad/Tools/Linux/symbols.sh $$PWD $$OUT_PWD fred myQtCrasher 1.0 > $$PWD/Crashpad/Tools/Linux/symbols.out 2>&1"
-    QMAKE_POST_LINK += "&& cp $$PWD/Crashpad/attachment.txt $$OUT_PWD/attachment.txt"
+    QMAKE_POST_LINK += "mkdir $$OUT_PWD/crashpad"
+    QMAKE_POST_LINK += "&& cp $$PWD/Crashpad/Bin/Linux/crashpad_handler $$OUT_PWD/crashpad"
+    QMAKE_POST_LINK += "&& bash $$PWD/Crashpad/Tools/Linux/symbols.sh $$PWD $$OUT_PWD fred myQtCrasher $$MAJOR_VERSION"."$$MINOR_VERSION > $$PWD/Crashpad/Tools/Linux/symbols.out 2>&1"
+#    QMAKE_POST_LINK += "&& cp $$PWD/Crashpad/attachment.txt $$OUT_PWD/attachment.txt" #if any attachment is needed
 }

Build generates both myQtCrasher.debug, and externaly generated myQtCrasher.sym symbols file.

Using their dummy database (the creditals are fred@bugsplat.com and Flintstone as a password), I have managed to report crash, but I for some reason, the bug do not contain uploaded symbols. I have tried to manualy upload them using dump_syms and then symupload applications by sending request onto https://fred.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName=myQtCrasher&appVer=4.9, but without success.

The symupload application output is

Failed to open curl lib from binary, use libcurl.so instead
Successfully sent the symbol file.

How can I properly upload *.sym and view stack trace on crash?

Thanks for your help!

Brykyz
  • 587
  • 4
  • 30
  • Hi @Brkyz can you please email support@bugsplat.com? That will help us track your issue with our support tool so we can help you get your integration working – bobbyg603 Jul 02 '21 at 13:05

1 Answers1

2

We were able to get the symbols to resolve for this crash report. Right after the symupload warning Failed to open curl lib from binary, use libcurl.so instead it says successfully sent the symbol file. I confirmed the symbol file was uploaded correctly.

I found 2 issues with the symbol file. When minidump_stackwalk was looking for the corresponding symbols it was looking for:

/myQtCrasher-4.9/myQtCrasher/C03D64A46AB29A093459A592482836E50/myQtCrasher.sym

The file that was uploaded to BugSplat was myQtCrasher.debug.sym and the module on the first line of the sym file was myQtCrasher.debug. I changed the file name to myQtCrasher.sym and the module name to myQtCrasher and the symbols for the myQtCrasher stack frames displayed function names and line numbers.

I'm not sure if these issues with mismatched symbols were due to your script changes but it seems like our script attempts to set the following variables:

app="${2}/${4}.debug"
sym="${4}.sym"

Therefore the script expects the user to generate sym files from the .debug file, but name them based on the corresponding executable.

Dharman
  • 30,962
  • 25
  • 85
  • 135
bobbyg603
  • 3,536
  • 2
  • 19
  • 30
  • I haven't changed `app` and `sym` variable inside of bash script, only added `echo` for printing url. I will check names of the uploaded files and give feedback here. Thank you very much for your help! – Brykyz Jul 02 '21 at 19:33
  • You're welcome! It's definitely possible we made a mistake. If you find a problem with our script (or if our backend doesn't process something correctly), please email us or send us a message via the in-app chat on bugsplat.com. – bobbyg603 Jul 03 '21 at 13:01
  • I have tried to find the problem in scripts or my application, but without success. I tried manual uploading via `myQtCrasher/Crashpad/Tools/Linux/symupload ./myQtCrasher.sym "http://Fred.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName=myQtCrasher&appVer=1.0"`, but the result is same. It looks like `dump_symbs` generates symbols with `myQtCrasher.debug` on the first line of symbols. Making any symbols file from `*.debug` automaticly generates `*.debug` on the first line. Maybe debug shoudn't be separated file? – Brykyz Jul 07 '21 at 05:57
  • Dumping symbols from a separate .debug file used to work. Perhaps the functionality has changed since we last investigated? You can try removing the line in the Qt pro file that creates the separate .debug file and seeing if that helps. You can also write a script that renames the file and removes the .debug from the module name as a workaround while we investigate the issue. Can you please email support@bugsplat.com so we can track this issue and schedule engineering time to investigate the issue? Thanks! – bobbyg603 Jul 07 '21 at 17:09