title: debugging C with eclipse and cygwin
body: <p>I am trying to debug the following C code with eclipse-Juno-CDT, and cygwin-gcc (cygwin version=1.7.16, gcc version=3.4.4, gdb version=7.5.50), on 64bit windows. The code works fine in normal mode. Initially debugger was not running, because the source file was not found. Then I searched around and added the path mapping information (from /cygdrive/c to C:\). Now it is running but with the following problems:</p>
  
  <ol>
  <li><p>I have put a breakpoint before the "hello c 1" line, and  then single stepping. But nothing gets printed on the console.</p></li>
  <li><p>after single stepping on the last line ("exit"), I get the error: "No source available for _cygwin_exit_return() at ..."</p>
  
  <pre><code>// stdio.h and stdlib.h are included, but when I put a #include the code
  // they dont show up, so I deleted those lines in this code fragment.
  int main(void) {
       int a=10;
       int b=5; // breakpoint on this line, single step after this
       printf("hello c 1\n"); // these outputs are not printed in console
       // fflush(stdout);
       printf("A=%d, B=%d\n", a, b); // but debugger shows the correct values in data window
       // fflush(stdout);
       return EXIT_SUCCESS; // error on this line
  }
  </code></pre></li>
  </ol>
  
  <p>Added later: After some more debugging, I figured that even after the exit-error, if I do a "continue", then I am getting the lines on the console after the program terminates. So I added extra "fflush(stdout)" lines, and now I can see the outputs when they are being printed.</p>
  
  <p>But how to fix the exit-error problem? Also, editing the file to add fflush to see debug outputs is a pain - is there a way to avoid this? Can somebody help me with this very basic problem, or point me to a place where the solution is given? Thanks in advance.</p>