PDA

View Full Version : I want runtime error output in qt creator IDE



Si1ver
20th June 2009, 00:06
Hey, developement is very slow for me at the moment because everytime I get a runtime error, there messages are not useful.

For example if I accident try to access a null pointer memory, instead of telling me null pointer exception and showing me the point in my code where this happened during runtime, I get a useless message saying assert error and a line within qt code of where this happened. Not useful at all, I have to step through each line in the code to find out where the exception is in my source code and then I have to try and work out the cause.

How do I get qt to just output runtime error/exceptions and tell me the line in my code where this happens and not a generic line of code inside qt where it happenes.

Thank you

Lykurg
20th June 2009, 00:19
Build your application in debug mode and run it with gdb. Then you get exactly the line where your app crashes.

Si1ver
20th June 2009, 00:27
Hi, thank you for your reply.

In QtCreator, the Build -> Set build configuration -> debug button appears true. How do i use gdb to do it?

Sorry it is my first project in QtCreator.

Silver

Lykurg
20th June 2009, 00:46
If your profile is right and you are working under Linux just hit the "debug" button which is direct under the normal run button in the creator. Or simply hit F5.

(Normally gdb is installed. If not search your sources for that package, depending which distro you use.)

Si1ver
20th June 2009, 01:06
This is what I do already. But I still get this error message.


Unable to restore previously selected frame.
Unable to restore previously selected frame.
Unable to restore previously selected frame.

ASSERT failure in QVector<T>::at: "index out of range", file /home/silver/Programs/qtsdk-2009.02/qt/include/QtCore/qvector.h, line 329

Which doesn't give me a line in my code :(

wysota
20th June 2009, 01:11
Why don't you just go to a higher frame to see where your code entered the invalid state? The current behaviour you observe is correct - Qt detects a problem during its own internal checks and notifies you about it. There is no access violation or anything just yet, so the program crashes in Qt code and not yours (because yours didn't have a chance to crash just yet). If you don't want those assers, build your application in release mode - then a "real" crash will occur.

Si1ver
20th June 2009, 02:17
I understand this, but I have no idea how to do this? I don't know how to check other frames as you mentioned or how to build in release mode.

Im using QtCreator IDE under Ubuntu Linux Distro.

Thank you

wysota
20th June 2009, 02:27
Click on the frame in the debugger...

Si1ver
20th June 2009, 03:42
What is a frame :(? Do you mean like a view or window inside the IDE, because I checked them all out.

I looked everywhere in the debugger part and I cannot find any output that shows error messages relevant to my source code instead of theres. I mainly want to know where in my source code I called the qt parts that are erroring. :(?

thanks

wysota
20th June 2009, 10:23
I mean a stack frame. If you don't know what it is, better learn it first before you get your hands wet with debugging.

Si1ver
20th June 2009, 16:00
O it shows the stack, brilliant. I found it now.

Hehe Its my first time acculi using an IDE properly, ive always just used make files. But thank you in the end :P

wysota
20th June 2009, 22:13
Makefiles don't help much with debugging...

By the way, Qt uses make too and IDE has nothing to do with it - it's an advanced text editor with integrated debugger and help system.