fabiopedrosa
fabiopedrosa

Reputation: 2581

Qt: Finding memory leaks and errors

I'm developing an application in Qt, and I'm having problems debbuging the application to find errors that crash my application with a runtime errors. Errors like array access out of bounds or wrong pointers access.

QT Creator simply doens't recognize this runtime error. All I have is the exit code, and sometimes an assert fail message in the application output. Something like:

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 where this access is being made? I tried running gdb on my app executable, but after the application exits with an error code (03 in this above example) there's no backtrace (no stack available).

I have VS installed, and sometimes it asks to debug the exception (not this case :/) but even so, doens't recognize mingw32 debug symbols and only gives me a dissasembled view.

Ideally I would have QT Creator dump stack before such asserts that crash my application. Any tips?

Upvotes: 3

Views: 1986

Answers (1)

Caleb Huitt - cjhuitt
Caleb Huitt - cjhuitt

Reputation: 14941

If you are having problems debugging that, try creating your own message handling function for Qt's debug/warning messages, and putting a breakpoint in that function. Then you're program should stop whenever one of those messages is printed.

Upvotes: 2

Related Questions