PDA

View Full Version : Debugging ASSERT failure in Qt header.



Doug Broadwell
22nd December 2008, 01:35
Qt 4.2.3, windows, mingw.

I'm getting an assert failure from qbytearray.h (qba.at(x) subscript out of range). Is there any way in the mingw environment to determine which function this error is occurring in?

Thanks,
Doug

spirit
22nd December 2008, 07:33
could you show us code which can reproduce this bug?

wysota
22nd December 2008, 08:07
Is there any way in the mingw environment to determine which function this error is occurring in?

You are referencing a non-existing index of the byte array somewhere in your code. You can use a debugger and print a backtrace to see the list of function calls you are in but in this situation it is much easier to inspect your code, you're probably "off by one" somewhere or you didn't initialize some array properly.

Doug Broadwell
23rd December 2008, 00:14
The problem is I don't know where in my code this is happening and there's a fair bit of it (too many modules, too large to post). I know that the problem is index out of range but placing my own asserts in all locations that access QByteArrays, or objects derived from QByteArrays, would be onerous.

Is there a GDB (or any other) implementation of a debugger that will run in the windows/mingw environment?

Thanks

Doug Broadwell
23rd December 2008, 00:17
I should have added that the error occurs sometimes but not others and I haven't been able to create a situation that adjusts the frequency of occurrance - or force it to happen.

Doug

wysota
23rd December 2008, 00:29
GDB works fine under Windows with MinGW.

Doug Broadwell
27th December 2008, 01:40
Thanks!

I feel like an idiot for not thinking of this myself (old age setting in I'm afraid).

Doug