Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved How to debug "Exception Triggered: The inferior stopped because it triggered an exception"?

    General and Desktop
    qt 5.5 exception debugging msvc2017
    3
    4
    2619
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      elsa last edited by elsa

      Hello everyone,
      i have been having a lot of unexpected complications in my program for some time now. First I wanted to use QtBluetooth 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:
      0_1535099990491_error exception.PNG

      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:
      0_1535101570087_error exception end.PNG
      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!

      jsulm JonB 2 Replies Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @elsa last edited by

        @elsa My guess is that window3d() returns a nullptr. You should check this first.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 5
        • JonB
          JonB @elsa last edited by JonB

          @elsa

          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 a int &argc, as opposed to the int argc you can see QApplication base constructor is called with? There's a big difference between int and int &, it's "unusual" to have a C++ program passed an int &argc. And if it is a int &, what is reference "pointing to", and particularly what is that variable's value? Having a huge argc value could have start-up code marching all over the place through your argv....

          1 Reply Last reply Reply Quote 1
          • E
            elsa last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post