Hi,
I have following code:
============== crasch.cpp ======================
#include <QThread>
#include "client/linux/handler/exception_handler.h"
class MyThread : public QThread {
public:
virtual void run();
void crash();
};
void MyThread::run() {
crash();
}
void MyThread::crash() {
volatile int* a = (int*)(NULL);
*a = 1;
}
static bool dumpCallback(const char* dump_path, const char*
minidump_id, void*, bool succeeded) {
if (succeeded) {
printf("Dump path: %s/%s.dmp\n", dump_path, minidump_id);
} else {
printf("Failed to write crash dump\n");
}
return succeeded;
}
int main(int, char **){
google_breakpad::ExceptionHandler eh("/tmp", NULL, dumpCallback,
NULL, true);
MyThread a;
a.start();
return 0;
}
============== end of crasch.cpp ======================
==============
crasch.pro ======================
TEMPLATE = app
SOURCES = crash.cpp
CONFIG += console
INCLUDEPATH += /home/krikar/Tools/google-breakpad/trunk/src
============== end of
crasch.pro ======================
Now when I build an run the code:
krikar@krikar-desktop:~/foo$ qmake
crash.pro
krikar@krikar-desktop:~/foo$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -
DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/
include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I../
Tools/google-breakpad/trunk/src -I. -o crash.o crash.cpp
g++ -Wl,-O1 -o crash crash.o -L/usr/lib -lbreakpad_client -lQtGui -
lQtCore -lpthread
krikar@krikar-desktop:~/foo$ ./crash
QThread: Destroyed while thread is still running
krikar@krikar-desktop:~/foo$
Google breakpad does not catch the crash. Why? I have similar problmes
in other QThread apps, where breakpad actually catches a crash in a
thread, but writes empty minidump files.