Advanced debugging: find call which triggers Qt-errors
Currently the debugging version of the Qt-libraries is not available. But I receive a report "QIODevice::write (QIODevice): Called with maxSize < 0"
deep within them.
Our codebase is quite large, I am more familiar with other sections and let's say it: some is 'legacy'. So, where to start looking?!?
Yesterday I remembered a trick to get via call-stack to the last-recent position where our functions trigger that mistake.
Inserted in the main.cpp after show from the MainWindow was called a
1 |
qInstallMessageHandler(messageHandler); |
which stands for this
1 2 3 4 5 6 7 8 9 10 11 12 13 |
void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg ) { Q_UNUSED(context); switch( type ) { case QtDebugMsg: qDebug() << msg.toLatin1().data(); break; case QtWarningMsg: qDebug() << msg.toLatin1().data(); break; case QtInfoMsg: qDebug() << msg.toLatin1().data(); break; case QtCriticalMsg: qDebug() << msg.toLatin1().data(); break; case QtFatalMsg: qDebug() << msg.toLatin1().data(); break; default: qDebug() << msg.toLatin1().data(); break; } } |
Add a breakpoint in the messageHandler and debug the app. Maybe disable the breakpoint until you start to trigger the critical functionality.
When it breaks, you have a nice callstack and can backtrace where it came from :)
how to resume broken downloads
aka: fix the weird firewalling settings ..
aka: How to download the latest stable Qt SDK source code?
curl -L -O -C - http://download.qt.io/official_releases/qt/5.12/5.12.3/single/qt-everywhere-src-5.12.3.zip