Qt: detect memory leaks and errors

I am developing an application in Qt and I am having problems debbuging an application to find errors that crash my application with runtime errors. Errors such as accessing an array outside of bounds or improper pointer access.

The creator of QT simply does not recognize this runtime error. All I have is an exit code, and sometimes an assert error message in the application output. Sort of:

ASSERT failure in QList<T>::operator[]: "index out of range", file c:/Qt/2010.05/qt/include/QtCore/../../src/corelib/tools/qlist.h, line 463

How can I find the point at which this access is made? I tried to run gdb in an executable application, but after exiting the application with an error code (03 in this example above) there is no backtrace (no stack).

I have VS installed, and sometimes it asks for debugging an exception (not in this case: /), but even in this case it does not recognize mingw32 debugging symbols and only gives me a parsed view.

Ideally, I would have a bunch of QT Creator dump in front of such statements that crashed my application. Any tips?

+3
source share
1 answer

If you are having trouble debugging, try creating your own message handling function for Qt error messages and warnings, and set a breakpoint in this function. Then you should stop when one of these messages is printed.

+2
source

Source: https://habr.com/ru/post/1777229/


All Articles