In a command prompt I browsed to C:\MinGW\bin and ran:
mingw-get.exe install gdb
That fixed it for me. Not sure if it matters but I have C:\MinGW\bin in my path (guess I probably didn't need to browse to C:\MinGW\bin).
Answer from John on Stack OverflowVideos
In a command prompt I browsed to C:\MinGW\bin and ran:
mingw-get.exe install gdb
That fixed it for me. Not sure if it matters but I have C:\MinGW\bin in my path (guess I probably didn't need to browse to C:\MinGW\bin).
The Current Release (5.2.1) version of gdb at the project files page has always worked for me. The download is a stand-alone .exe, you don't need anything else.
But I'll bet the .exe in the 6.8 package will work, too. I'd try using just the .exe, and then if there are problems, try extracting the other files from the 6.8 package. (Though that may cause problems with the rest of the MinGW installation.)
Update: There seems to be a 7.something version. I haven't tested it thoroughly, but it seems to work, even with gcc 3.
No idea what MinGW Installation Manager is or why you were trying to use it when you are using msys2.
To install mingw64 gdb in msys2, you really just need to:
pacman -S mingw-w64-x86_64-gdb
You should probably run pacman -Syu twice before you run the above though.
As you can see, if you need other mingw64 builds of programs (toolchain programs or not), their package names would be prefixed with mingw-w64-x86_64-. There's also the package group mingw-w64-x86_64-toolchain which you can pacman -S --needed instead to get a somewhat full toolchain.
You may also want to use the urt64 toolchain instead. See this page for more details. (You can e.g. pacman -Ss gdb to find out what's the package name prefix for each of the variants.)
Note that to use any of the toolchain (or any non-msys2 builds of programs), you should use the corresponding "launcher" of shell/terminal instead of msys2.exe.
Check by restarting your PC, if it didn't work download the *.gdb file from its website (I guess it's a *.rar or some file), now update with MSYS and restart. It have solved for me, I guess it helps....
- Make sure you have followed the MinGW installation as in https://www.msys2.org/ or if you were using installer from link to installer to install MYSYS then you have to continue from step 5 to install required compiler tools use following command insted of step 6 command
pacman -S --needed base-devel mingw-w64-x86_64-toolchain
You should add the same Installation Folder used in step 3 of installation instruction to the system PATH variable or if you have used installer to install the MinGW find the MinGW installation directory by opening your C drive and add that path to system PATH (in my case Ex: C:\msys64\mingw64\bin)
Make sure the C:\msys64\mingw64\bin is not empty, if it's empty mostly you haven't continued from the step 5 after installing MYSYS from installer
After adding system PATH, close and open cmd window just type path in cmd and enter to make sure your MinGW path is addedd to system PATH, (you can copy paste the output to notepad/notepad++ and search MinGW to find the path)
Once MinGW is in the path your gdb command should work (please provide this screenshot of path command output, if it's still didn't work)
If you install according to https://code.visualstudio.com/docs/cpp/config-mingw, MSYS2.exe direct install.
check if your path: \msys64\mingw64\bin is empty? if it is empty, it shows the gdb is missing. Follow my step 2
open this website, https://packages.msys2.org/packages/mingw-w64-x86_64-gdb, copy the installation comman: pacman -S mingw-w64-x86_64-gdb
open the MSYS2 installed in your computer, past: pacman -S mingw-w64-x86_64-gdb, the comman you copied in step 2.
if you see the path: \msys64\mingw64\bin is filled with files. You're successeful. Open a cmd window, and input: gbd --version.
The first step is to compile your program with -g to include debugging information within the executable:
g++ -g -o myprog.exe mycode.cpp
Then the program can be loaded into gdb:
gdb myprog.exe
A few commands to get you started:
break mainwill cause the debugger to break whenmainis called. You can also break on lines of code withbreak FILENAME:LINENO. For example,break mycode.cpp:4breaks execution whenever the program reaches line 4 ofmycode.cpp.startstarts the program. In your case, you need to set breakpoints before starting the program because it exits quickly.
At a breakpoint:
print VARNAME. That's how you print values of variables, whether local, static, or global. For example, at theforloop, you can typeprint tempto print out the value of thetempvariable.stepThis is equivalent to "step into".nextoradv +1Advance to the next line (like "step over"). You can also advance to a specific line of a specific file with, for example,adv mycode.cpp:8.btPrint a backtrace. This is a stack trace, essentially.continueExactly like a "continue" operation of a visual debugger. It causes the program execution to continue until the next break point or the program exits.
The best thing to read is the GDB users' manual.
There are a few gdb guis for windows in this question windows version of the GDB frontend DDD
Although DDD hasn't been ported