Advanced debugging: find call which triggers Qt-errors

Written by  on April 26, 2019 

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

which stands for this

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 :)

Category : C++QtQtCreator