Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 04:39 Go to next message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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 06:45 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Which gdb version? Which OS? Can you post a simple example?

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debugger freezes upon program asking for user input. [message #635949 is a reply to message #635775] Thu, 28 October 2010 16:50 Go to previous messageGo to next message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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 06:55 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
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?



Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debugger freezes upon program asking for user input. [message #636215 is a reply to message #635775] Fri, 29 October 2010 16:42 Go to previous messageGo to next message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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 12:57 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
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".

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debugger freezes upon program asking for user input. [message #636823 is a reply to message #636677] Wed, 03 November 2010 00:00 Go to previous messageGo to next message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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 08:24 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
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?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debugger freezes upon program asking for user input. [message #637068 is a reply to message #635775] Thu, 04 November 2010 02:43 Go to previous messageGo to next message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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 08:53 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
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?


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debugger freezes upon program asking for user input. [message #637186 is a reply to message #637107] Thu, 04 November 2010 14:08 Go to previous message
Greg Akers is currently offline Greg AkersFriend
Messages: 6
Registered: October 2010
Junior Member
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: Tue Nov 05 04:49:13 GMT 2024

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

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

Back to the top