
There is already a pair of pre-made batch files for debugging the OHRRPGCE. Or you can create a batch file with the same command in it. From a command-line prompt, you can type:Ĭ:\mingw\bin\gdb.exe program_to_debug.exe

(These instructions are for mingw32, not the mingw-w64 fork. To install files distributed by MinGW we suggest you use the mingw-get installer. The packages within the MinGW/Extension directory are supported by the MinGW development team they provide useful facilities, but they are not considered essential for a basic MinGW installation. You can get the latest mingw installer here which can in turn install gdb.Īfter installing MinGW, run the "MinGW Installation Manager" (which for me was located in C:\MinGW\libexec\mingw-get\guimain.exe ) and then make sure that the mingw32-gdb bin package is installed. MinGW - Minimalist GNU for Windows Files. MinGW distributes a Windows version of gdb. If you are using Linux, you probably already have gdb, but if you are using Windows, you will need to install it. When used together with gdb, it can provide useful information about crashes. The latest debug build of the OHRRPGCE is available here: ohrrpgce-wip-directx-sdl-debug.zip. 1 getting a debug build of the OHRRPGCE.The best thing to read is the GDB users' manual. It causes the program execution to continue until the next break point or the program exits. continue Exactly like a "continue" operation of a visual debugger.You can also advance to a specific line of a specific file with, for example, adv mycode.cpp:8. next or adv +1 Advance to the next line (like "step over").Once it is completed, you can locate gdb binary located at gdb-7.11/gdb/gdb. So you can sit back and have cup of coffee for a while. step This is equivalent to "step into". /configure gdb-7.11 make This step will take a bit of time.For example, at the for loop, you can type print temp to print out the value of the temp variable. That's how you print values of variables, whether local, static, or global. This step is for Windows users only and describes how to install: g++. In your case, you need to set breakpoints before starting the program because it exits quickly. To install the debugger ( gdb ) for C and C++ ( For 64 bit ) pacman -S mingw-w64. For example, break mycode.cpp:4 breaks execution whenever the program reaches line 4 of mycode.cpp. You can also break on lines of code with break FILENAME:LINENO. break main will cause the debugger to break when main is called.Then the program can be loaded into gdb: gdb myprog.exe

The first step is to compile your program with -g to include debugging information within the executable: g++ -g -o myprog.exe mycode.cpp
