How to debug "Exception Triggered: The inferior stopped because it triggered an exception"?
-
Hello everyone,
i have been having a lot of unexpected complications in my program for some time now. First I wanted to useQtBluetooth
on Windows, so I had to change the compiler to MSCV. This resulted in some linker errors that are also resolved now.
I thought now I should have a functioning program again with the new compiler, but no! No it builds without problems, but when running/debugging I get the following exception:
I would think that read access violation comes when I try to access memory/variables that are not initialized etc. But this is not the case here, until now I couldn't make sense of the problem. So my question is how can you debug an exception like this one?
Note: The screenshot is from the constructor of my subclass for QApplication and_ready
is a member variable.
Note 2: I tried commenting out the line and the exception just appears somewhere else, and then I disable this line and so on, until the exception just shows on the last bracket of the constructor:
Note 3: In some cases, when I leave out some lines the debugger starts and never finishes and doesn't show any messages, and then there is apparently some instance still running in the background that I cannot access (not visible in the task manager). To be able to run the program again I have to restart the computer..
Note 4: The program was and still is working fine with the MinGW compiler! That's why I am so confused.I would be very thankful for any guidance to make sense of this.. and some ideas to solve it.
Thanks in advance! -
Note 2: I tried commenting out the line and the exception just appears somewhere else, and then I disable this line and so on, until the exception just shows on the last bracket of the constructor:
You commented out every line and it still errors?? That would negate @jsulm 's suggestion....
One thing: there is nothing wrong with it per se, but you're sure your
RTLSDisplayException
constructor/call takes aint &argc
, as opposed to theint argc
you can seeQApplication
base constructor is called with? There's a big difference betweenint
andint &
, it's "unusual" to have a C++ program passed anint &argc
. And if it is aint &
, what is reference "pointing to", and particularly what is that variable's value? Having a hugeargc
value could have start-up code marching all over the place through yourargv
.... -
@jsulm there was in fact a problem with window3d() that MinGW didnt complain about! Thanks!
@JonB no I had commented out only up to the second screenshot, so that's why this was the problem.
And about the second issue, to be honest I adapted the constructor from an older version of the application and it also had&argc
. At one point I also noticed it and now I tried out both and both work.