简体   繁体   中英

MinGW gdb ignoring breakpoints when used with Eclipse CDT

I'm trying to set up a Windows 7 machine with Eclipse CDT (Kepler) and MinGW. Here follow the steps I perfomed:

  1. I downloaded and installed MinGW from the official repository
  2. I downloaded and installed the latest (Kepler) Eclipse CDT from the official website
  3. I updated the PATH global variable so as to include the MinGW bin path C:\\MinGW\\bin . The PATH variable is also correctly set in the Environment section in Eclipse.

However, when I try to debug (in debug mode) a simple Hello World program, breakpoints are ignored and the execution continues until the end. I tried the following workarounds without success:

  • adding the following linker flags: -static-libgcc -static-libstdc++
  • manually specifying the binary parser ( PE Windows Parser )
  • change the preferred launcher to Standard: create process launcher
  • adding the following lines at the beginning of the main function: setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0);

Any suggestion? thanks.

For me, the problem was that my program's console output messed up gdb's console output, which is parsed by Eclipse.

The solution was to tell gdb to allocate a new console for the program output, by adding " set new-console on " to your .gdbinit file (Make also sure the .gdbinit file is specified under "Debugger options" in Eclipse).

There's also a discussion about this here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=327766

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM