Why is my QT Application breaking in disassembly code on debug start?
-
wrote on 22 Mar 2024, 05:08 last edited by jabroni
My QT application has been running fine on my Windows 11 machine for almost two years since I took over development for it. Recently what's happened is that when I start the program in debug mode, it first breaks in disassembly code with the following exception trigger pop up message:
The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x772a1fdf, code: 0xc0000005: read access violation at: 0xbaadf00c, flags=0x0 (first chance).
Running the code after this exception is triggered launches the program, but the program will occasionally break in disassembler again and crash.
I am compiling with MSVC and I've tried a number of different compilers and have tried QT versions 5.2.0, 5.14.1, and 5.15.2 and all produce the same error on Windows 11. I have also tried different combinations of Windows SDK packages, and all produce the same result. I have tried VS Build tools 2015, 2017, and 2019 with no change.
I ended up installing Windows 10 on another machine and ran the setup with QT 5.14.1, MSVC compiler 15.9.28307.2094, and Windows 10 SDK 10.0.17763.132 where it runs as expected with no problems.
This one has really confused me.
-
wrote on 22 Mar 2024, 16:00 last edited by SamiV123
Do you have global objects?
Smells like an issue related to the construction of non local global objects which have undefined construction order. That typically manifests itself as a mysterious crash before your "main" is ever even called.
-
My QT application has been running fine on my Windows 11 machine for almost two years since I took over development for it. Recently what's happened is that when I start the program in debug mode, it first breaks in disassembly code with the following exception trigger pop up message:
The inferior stopped because it triggered an exception. Stopped in thread 0 by: Exception at 0x772a1fdf, code: 0xc0000005: read access violation at: 0xbaadf00c, flags=0x0 (first chance).
The disassembler stops here:
Running the code after this exception is triggered launches the program, but the program will occasionally break in disassembler again and crash.
I am compiling with MSVC and I've tried a number of different compilers and have tried QT versions 5.2.0, 5.14.1, and 5.15.2 and all produce the same error on Windows 11. I have also tried different combinations of Windows SDK packages, and all produce the same result. I have tried VS Build tools 2015, 2017, and 2019 with no change.
I ended up installing Windows 10 on another machine and ran the setup with QT 5.14.1, MSVC compiler 15.9.28307.2094, and Windows 10 SDK 10.0.17763.132 where it runs as expected with no problems.
This one has really confused me.
QT Setup on my Win 11 machine:
-
wrote on 25 Mar 2024, 01:21 last edited by jabroni
I am using QT Creator as my build and debug tool. This is not an issue with the code. I just created a new QT project with the base code that is provided by default, and that gives me the same error:
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
-
wrote on 25 Mar 2024, 01:36 last edited by
If you have an anti-virus app running, try disable it.
-
wrote on 25 Mar 2024, 01:49 last edited by
@hskoglund Unfortunately no luck. I only have standard windows anti virus protection. I disabled firewall and all settings under "Virus & Threat Protection Settings", amongst other security settings.
-
wrote on 25 Mar 2024, 02:02 last edited by
And if you try another project, for example Application in Examples, I'm guessing you get the same crash?
-
And if you try another project, for example Application in Examples, I'm guessing you get the same crash?
wrote on 25 Mar 2024, 02:09 last edited by@hskoglund Yep - Just tried with QT 5.14.1 and 5.15.2 and both crashed.
-
@hskoglund Yep - Just tried with QT 5.14.1 and 5.15.2 and both crashed.
wrote on 25 Mar 2024, 02:43 last edited by@jabroni What is the stack backtrace when the failure occurs. The original error message is from attempting to access memory that does not belong to your process or accessing through a null pointer. In this case the address is in EAX and is 0xbaadf00c (which looks suspiciously like a common flag value 0xbaadf00d (bad food)).
If you put a breakpoint on the first line inside main() does the program get that far?
What non-Qt libraries, ActiveX controls etc are linked to your application?
-
@jabroni What is the stack backtrace when the failure occurs. The original error message is from attempting to access memory that does not belong to your process or accessing through a null pointer. In this case the address is in EAX and is 0xbaadf00c (which looks suspiciously like a common flag value 0xbaadf00d (bad food)).
If you put a breakpoint on the first line inside main() does the program get that far?
What non-Qt libraries, ActiveX controls etc are linked to your application?
wrote on 25 Mar 2024, 03:15 last edited by jabroni@ChrisW67 I'll just focus on the main.ccp file in the Applications example project now as that should be what everyone else has.
Just as my program, the "crash" occurrs once the
.show()
function is called. In this case it'smainWin.Show()
. Stepping over/into that fails to disassembler:
Also, in my main application I am developing, the only external library that is used is QWT 6.1.3 (as far as I am aware - please let me know if there's a way I can check this). However, even with the Application example project which is 80 lines of code the same error occurs.
-
wrote on 25 Mar 2024, 03:25 last edited by
Just guessing, but are you using OneDrive for running Qt?
-
wrote on 25 Mar 2024, 03:30 last edited by
@hskoglund I do have OneDrive enabled, however my QT application runs out of my local git folder, and QT is installed in
C:\Qt
. -
wrote on 25 Mar 2024, 03:35 last edited by
Ok. And just to clarify, if you rebuild the Application example in Release mode it does not crash, it only crashes in Debug mode?
-
Ok. And just to clarify, if you rebuild the Application example in Release mode it does not crash, it only crashes in Debug mode?
wrote on 25 Mar 2024, 04:28 last edited by jabroni@hskoglund So:
Release Mode
Start with debugging = same crash
Start with no debugging = no crashDebug mode
Same as aboveSo it looks like debug run is the issue here I think.
And these are the buttons I am referring to when I say "start with debugging":
-
wrote on 25 Mar 2024, 05:10 last edited by
-
wrote on 26 Mar 2024, 01:07 last edited by
@hskoglund well okay that omits that error from startup haha. Which solves that problem, however if I enter a breakpoint during debug runtime of my application it breaks into disassembler code:
ntdll!DbgBreakPoint: 0x772c8c00 int 3 0x772c8c01 <+ 1> ret 0x772c8c02 <+ 2> int 3
-
@hskoglund well okay that omits that error from startup haha. Which solves that problem, however if I enter a breakpoint during debug runtime of my application it breaks into disassembler code:
ntdll!DbgBreakPoint: 0x772c8c00 int 3 0x772c8c01 <+ 1> ret 0x772c8c02 <+ 2> int 3
-
wrote on 29 Mar 2024, 08:15 last edited by
@jabroni Hi, I've met same issue with you.
But not as your case, my code have a problem with "tr" function when using with static variable.
I fix that follow the guide here https://forum.qt.io/topic/33568/qt-tr-not-working-if-i-am-using-in-static-member
Hope it can help you. -
@jabroni Hi, I've met same issue with you.
But not as your case, my code have a problem with "tr" function when using with static variable.
I fix that follow the guide here https://forum.qt.io/topic/33568/qt-tr-not-working-if-i-am-using-in-static-member
Hope it can help you.wrote on 1 Apr 2024, 11:55 last edited by@ngocanhnu I don't think that's quite the same problem, but thank you.
1/19