Different behavior in Debugger or normal application


I'm trying to develop a socket application in Linux (I don't know if it's a specific socket problem, by the way) and am running into reading problems.
When I run the application as a normal C++ application in Eclipse, it freezes after a read operation is performed.
When I run the same application in the debugger there are no problems.

What could be causing this difference? How should I deal with this?

You're probably running into undefined behavior. Run the program through Valgrind to find if you're manipulating the memory incorrectly anywhere.
What could be causing this difference?

When running in debugging mode the memory may be laid out differently.
Presumably you are overrunning an array somewhere and writing over other data thus causing the problem.
In debugging mode, if the memory is laid out with a little more space around the array then the overrun won't cause the same "freezing" problem, although it's still obviously a bug.
It took 15 minutes to install valgrind and receive the following:

==12915== Warning: invalid file descriptor -1 in syscall close()

I don't know where I can find this but at least I know where I have to look for!
Topic archived. No new replies allowed.