Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 385363

Summary: No console output and ignore user's input functions when debugging.
Product: [Tools] CDT Reporter: hooluupog <QQ510371827>
Component: cdt-debugAssignee: cdt-debug-inbox <cdt-debug-inbox>
Status: CLOSED DUPLICATE QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 CC: cdtdoug, marc.khouzam, pawel.1.piech
Version: 8.1.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description hooluupog CLA 2012-07-18 00:39:46 EDT
Build Identifier: Version: Juno Release Build id: 20120614-1722

I'm running windows 7 32bit,eclipse juno for c++ developer 32bit and mingw32.
Two issue appears here when i debug my app:
1) No console output( eg.printf(...) ).  I googled the bug and add mingw path in eclipse ,it doesn't work.
2).Ignore my input function for me to input values.
 for example,
        char s[255],*p,*q;
	int i=0,n;
	fgets(s,255,stdin);// the debugger ignore the function and disallow me to give an input
	p = q = s;
*	s[strlen(s)-1] = '\0';// toggle breakpoint at this line


Reproducible: Always
Comment 1 hooluupog CLA 2012-07-18 01:15:25 EDT
FYI, After i added fflush(stdout) after printf() or added the following lines
 setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0); 
in the start of the main function to do debugging again,  the debugger halted and said:
 '*stopped,reason="end-stepping-range",frame={addr="0x004014f5",func="main",args=[],file="..\ReverseString.c",fullname="D:\Users\workspace\Reverse_String\ReverseString.c",line="36"},thread-id="1",stopped-threads="all"' .
Comment 2 hooluupog CLA 2012-07-18 02:27:39 EDT
I hava tried again and found some interest thing. if i changed my code from 'printf("%c",*p)' to 'printf("%c\n",*p)', the debugger console finally showed the output. Seems as if the standard output is buffered and the buffer is flushed on newline during debugging. But it always shows output normally when i just run my app,	that ' s weird.
Comment 3 hooluupog CLA 2012-07-18 23:40:07 EDT
After i added "set new-console on" command into .gdbinit file and now eclipse debugger works well with externel input/output console window(it shows output and waits for my input before running at the breakpoint ). Maybe the bug is only related to eclipse's internal console on windows OS platform.
Comment 4 Marc Khouzam CLA 2012-07-19 07:34:39 EDT

*** This bug has been marked as a duplicate of bug 231883 ***