开发者

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 lik开发者_如何学运维e 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜