can't debug small program on eclipse helios cdt using mingw/gdb under windows, console freezes

空扰寡人 提交于 2019-12-04 23:38:24

15^running looks as a result record from gdb's Machine Interface. Normally it shouldn't appear in the Eclipse console.

I recommend trying a different Create Process Launcher. It can be changed in the following way:

  1. In Main menu choose "Run" -> "Debug Configurations...".

  2. In the opened "Debug Configurations" window shown below click "Select other..." opposite "Using GDB (DSF) Create Process Launcher".

  3. In the opened "Select Preferred Launcher" window shown below check "Use configuration specific settings", select "Standard Create Process Launcher" in the list below and click OK.

  4. Now go to the Debugger tab in the "Debug Configurations" window, select debugger, e.g. "MinGW gdb" and click Apply.

With the Standard Create Process Launcher I am able to debug your program although "put your name:" is printed only after I type something and hit Enter, because the output stream is not flushed.

ColWhi

Try having a look at this http://www.cprogramming.com/gdbtutorial.html and see if that helps. Like can you press CTRL-C to break?

Also Cannot enter input with gdb. Help! might be a pointer although related to apple.

the following is from the Eclipse website's FAQ:

http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_not_show_output_on_Windows

Eclipse console does not show output on Windows In Eclipse CDT on Windows, standard output of the program being run or debugged is fully buffered, because it is not connected to a Windwos console, but to a pipe. See bug 173732 for more details. Either add fflush calls after every printf or add the following lines in the start of the main function:

setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

Seems like an expected bug on windows.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!