Commit 18f9031b authored by Christian Kamm's avatar Christian Kamm
Browse files

qmldump: Add signal handler to catch segvs.

Reviewed-by: aep
parent 6dd55aa4
......@@ -17,9 +17,13 @@
#include <QtGui/private/qsimulatorconnection_p.h>
#ifdef Q_OS_UNIX
#include <signal.h>
static QHash<QByteArray, QList<const QDeclarativeType *> > qmlTypesByCppName;
static QHash<QByteArray, QByteArray> cppToId;
QString currentProperty;
QByteArray convertToId(const QByteArray &cppName)
......@@ -73,9 +77,11 @@ void processObject(QObject *object, QSet<const QMetaObject *> *metas)
QMetaProperty prop = meta->property(index);
if (QDeclarativeMetaType::isQObject(prop.userType())) {
qDebug() << " Processing property" <<;
currentProperty = QString("%1::%2").arg(meta->className(),;
QObject *oo = QDeclarativeMetaType::toQObject(;
if (oo && !metas->contains(oo->metaObject()))
processObject(oo, metas);
......@@ -259,8 +265,29 @@ void writeEasingCurve(QXmlStreamWriter *xml)
#ifdef Q_OS_UNIX
void sigSegvHandler(int) {
fprintf(stderr, "Error: qmldump SEGV\n");
if (!currentProperty.isEmpty())
fprintf(stderr, "While processing the property '%s', which probably has uninitialized data.\n", currentProperty.toLatin1().constData());
int main(int argc, char *argv[])
#ifdef Q_OS_UNIX
// qmldump may crash, but we don't want any crash handlers to pop up
// therefore we intercept the segfault and just exit() ourselves
struct sigaction action;
action.sa_handler = &sigSegvHandler;
action.sa_flags = 0;
sigaction(SIGSEGV, &action, 0);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment