Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8838181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:55:29+00:00 2026-06-14T09:55:29+00:00

I am trying to debug the following C code with eclipse-Juno-CDT, and cygwin-gcc (cygwin

  • 0

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:

  1. I have put a breakpoint before the “hello c 1” line, and then single stepping. But nothing gets printed on the console.

  2. after single stepping on the last line (“exit”), I get the error: “No source available for _cygwin_exit_return() at …”

    // 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
    }
    

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.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:55:31+00:00Added an answer on June 14, 2026 at 9:55 am

    While logically a C program begins at int main() and ends when that function returns, environments (like Windows or Cygwin) frequently add pre- and post-code, for initializing / breaking down memory management, opening / closing standard streams, and other such bookkeeping. An executable compiled with Cygwin, after returning from int main(), switches to a cleanup function _cygwin_exit_return(), provided by the Cygwin runtime – for which you don’t have sources, so your debugger complains.

    As for getting the output immediately, you could use an unbuffered output stream.

    Option one, use fprintf( stderr, ... ) (since stderr is by definition unbuffered). This, however, also affects the non-debugging behaviour of your program.

    Option two:

    int main()
    {
    // Using NDEBUG as also used by <assert.h>; feel free to use a different define
    #ifndef NDEBUG
        // For debugging, set stdout to unbuffered
        setbuf( stdout, NULL );
    #endif
        ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to debug my Django project via Eclipse. The app works fine
I'm trying to debug the following block of Javascript code to see what the
I am new to c++, trying to debug the following line of code class
Im trying to debug the following code using System; public class Parent { string
Ive got the following code: Trying to debug it for a while. Can't figure
I have the following code. Everything works perfectly, but I'm trying to figure out
I'm trying to debug something and I'm wondering if the following code could ever
I've got a Python library I am trying to debug (pyzeroconf). The following code
I am trying to debug C++ code using Eclipse Galileo on my MacBook Pro
I'm trying to debug the following code... @GET @Path(getGuestsXml) @Produces(application/xml) public Guest getGuestsXml() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.