How to open stack trace in QT?
-
Hi
Try
https://stackoverflow.com/questions/16735413/how-can-i-make-qtcreator-break-on-exceptions
( add new breakpint, dont matter where, set to Break on c++ exception )
Then it shows the origin of the trow -
@aha_1980
I'm using Qt Creator with default minGW7.3.0 64bit on Windows 10 1909. When I run the program above in debug mode it will just run normally and output a message(terminate ...) on the black console window. Then nothing shows up in the debugger window. -
@mrjj It's just like the program exits normally with the return value of 0. The debugger thinks that the program has already exited so it stopped showing things too. If you break on that line it stops but when you press F10, it will immediately stop execution the program.
-
@mrjj I think maybe the MSVC compiler has that function but minGW doesn't. So you can see that window pops out but I can't. But minGW's debugger is gdb, you can type bt in gdb and you can see the things you need. So accordingly, even if I'm using minGW, I should still have that function like gdb does.
-
@mrjj Moreover, if I add breakpoints at "Break when C++ exception is thrown", Whenever my program throws an exception. It will stop there, even if I had already caught it in the catch statement and solved it. The thing I want is the "UNHANDLED EXCEPTION". When the program doesn't handle the exception properly and cause the program to call std:: terminate() to terminate the program. QT debugger will stop there for me to see the stack trace and where the exception is thrown.
-
I find the solution to my problem. You can go to GDB Extended to check "the stop when abort() is called". Then it will stop at the line in which you throw an exception. But the problem is that there are no windows saying "Exception Triggered". That's very strange.
-
@PikaCat said in How to open stack trace in QT?:
But the problem is that there are no windows saying "Exception Triggered". That's very strange.
Is that a big problem? If the debugger stops at a throw, you should already know what happens.
You can go to GDB Extended to check "the stop when abort() is called".
Glad you found it and thanks for sharing!
Regards