It's kinda hard to explain but here's the problem: I'm trying to debug a program, so I've tried to launch GDB from the VSCode terminal, but I realized I'd need to have admin privileges to run the program properly, so I opened an instance of the Windows Terminal (admin) and ran GDB from there.
The program was hanging on every line where the system() function was called, throwing a message box saying The application was unable to start correctly (0xc0000142). Click OK to close the application., so I began thinking the error was caused by the system() call itself.
I then wrote a very simple test program to test if the problem was actually being caused by the system() function and ran GDB on the test executable from the VSCode terminal.
I didn't see any problem at first. Then, I ran GDB on the same test executable from an instance of the Windows Terminal (not admin this time), and I was able to see the same error message box I was seeing when running the previous program.
But here's where things get sketchy:
That error message box appears just when I'm running GDB ON a Windows Terminal AFTER setting the TUI layout to layout src.
If I don't set the TUI layout to SRC and stick with the CLI (the layout GDB uses when it first gets started up), and type n, n, n, the program runs just fine (no error gets thrown). It also runs fine with the same technique from the VSCode terminal.
Another thing I noticed is that, in both terminals, I can run the program only before setting the layout to SRC.
For instance, in VSCode I can set a breakpoint to main(), do run, then set the layout to SRC and then go n, n, n, I can debug the program just fine (same thing won't happen in Win Terminal due to that error message which gets thrown).
But if I first set the layout to SRC and then add the b+ and run the program, GDB says the following:
Starting program: E:\C++\test\test.exe
During startup program exited with code 0xc0000142.
(Same thing happens in Win Terminal too).
I'm really having a bad time trying to debug this thing, and surely GDB isn't helping me out.
If you're wondering, my test.cpp file contains the following:
#include <iostream>
int main() {
system("echo hello");
system("pause");
exit(0);
}
Hope anyone can help me out.