Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugger freezes upon program asking for user input.
Debugger freezes upon program asking for user input. [message #635775] Thu, 28 October 2010 00:39 Go to next message
Eclipse UserFriend
So when I go to debug and my program asks for user input(cin), the debugger freezes and never gives me a chance to even put in any input. Using latest GDB and Eclipse. Any Ideas?

Thanks!
Re: Debugger freezes upon program asking for user input. [message #635787 is a reply to message #635775] Thu, 28 October 2010 02:45 Go to previous messageGo to next message
Eclipse UserFriend
Which gdb version? Which OS? Can you post a simple example?
Re: Debugger freezes upon program asking for user input. [message #635949 is a reply to message #635775] Thu, 28 October 2010 12:50 Go to previous messageGo to next message
Eclipse UserFriend
GDB Version= 6.8-2
OS=Xp and 7(tried on both machines, same error).

I guess the most basic example i can give is: (This program works if I run it, but if I debug, when it gets to the 4th line, it will freeze and never ask me for my input. If I just set values myself to one,two,three and nix the cin line, then it will debug all the way through.

#include <iostream>

using namespace std;

int main() {

// inputs the numbers
cout << "Enter three numbers: ";
int one, two, three;
cin >> one >> two >> three;

int tmp;

// orders one and two
if (one > two) {
tmp = one;
one = two;
two = tmp;
}
// orders two and three
if (two > three) {
tmp = two;
two = three;
three = tmp;
}
// orders one and two
if (one > two) {
tmp = one;
one = two;
two = tmp;
}

// outputs the sorted numbers
cout << "The sorted numbers are: ";
cout << one << " " << two << " " << three << endl;
}
Re: Debugger freezes upon program asking for user input. [message #636042 is a reply to message #635949] Fri, 29 October 2010 02:55 Go to previous messageGo to next message
Eclipse UserFriend
You might be hit by the console flush problem on Windows.
http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_no t_show_output_on_Windows

Can you try to add flush commands after every cout/cin? Will it work then?

Re: Debugger freezes upon program asking for user input. [message #636215 is a reply to message #635775] Fri, 29 October 2010 12:42 Go to previous messageGo to next message
Eclipse UserFriend
That didnt fix anything. =(
Re: Debugger freezes upon program asking for user input. [message #636677 is a reply to message #636215] Tue, 02 November 2010 08:57 Go to previous messageGo to next message
Eclipse UserFriend
My last advice is to change the debugger framework used in your Debug Launch Config. I guess you are using DSF. You can change this in the main tab at the bottom to "Standard Process Launcher".
Re: Debugger freezes upon program asking for user input. [message #636823 is a reply to message #636677] Tue, 02 November 2010 20:00 Go to previous messageGo to next message
Eclipse UserFriend
It does the same thing, the cmd prompt never opens up and it freezes when it gets to cin. Would it be possible for someone to post a screenshot of their debugger config so I can mimic it(also what GDB theyre using)?

I can't think of anything else to do.
Re: Debugger freezes upon program asking for user input. [message #636874 is a reply to message #636823] Wed, 03 November 2010 04:24 Go to previous messageGo to next message
Eclipse UserFriend
Your example works for me on Linux with gdb 7.1 So I guess it is either a problem with gdb 6.8 or the console on Windows. Unfortunately, I cannot test it on Windows.
Can you update your gdb?
Re: Debugger freezes upon program asking for user input. [message #637068 is a reply to message #635775] Wed, 03 November 2010 22:43 Go to previous messageGo to next message
Eclipse UserFriend
I think I messed with stuff too much. I usually use cygwin but the latest versions is what I have, so I used "Install new software" and downloaded something from here "http://svn.codespot.com/a/eclipselabs.org/wascana/repo"

Now nothing works at all, even with Standard Process Launcher.

Is there a guide somewhere you could direct me to? Maybe I'm missing a step.

Thanks for the help, having a debugger would be really nice.
Re: Debugger freezes upon program asking for user input. [message #637107 is a reply to message #637068] Thu, 04 November 2010 04:53 Go to previous messageGo to next message
Eclipse UserFriend
Greg Akers wrote on Thu, 04 November 2010 03:43
I think I messed with stuff too much. I usually use cygwin but the latest versions is what I have, so I used "Install new software" and downloaded something from here "http://svn.codespot.com/a/eclipselabs.org/wascana/repo"

Now nothing works at all, even with Standard Process Launcher.

Is there a guide somewhere you could direct me to? Maybe I'm missing a step.

Thanks for the help, having a debugger would be really nice.

What does not work? Can you specify? Perhaps you mixed Cygwin and MinGW installation?
Re: Debugger freezes upon program asking for user input. [message #637186 is a reply to message #637107] Thu, 04 November 2010 10:08 Go to previous message
Eclipse UserFriend
debugging started giving me all new iostream errors. Is there a guide to debug C++ with eclipse that im not aware of?
Previous Topic:indexer issue
Next Topic:Show a function definition.
Goto Forum:
  


Current Time: Wed Apr 30 14:06:35 EDT 2025

Powered by FUDForum. Page generated in 0.10779 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top