I have just upgraded to Xcode 4 and am working in C++ project. I am finding that printf() intermittently fails to complete printing (mid-line) to the Xcode console, and from there on printf() ceases to print anything – even though the application continues to run in debugger.
I suspect Xcode 4’s console window is at fault because if I redirect stdout to a file, then logging seems to continue without any problems. That said, if I use following on command line:
tail -f log-out.txt
then there are times when incomplete lines are shown. But this is probably due to some sort of buffering (incomplete flush) because ultimately the lines are complete in the file.
So, I am wondering if anyone has experienced something like this and has an understanding of what’s causing freeze in Xcode’s console output.
This behavior seems to be intermittent and reportedly pre-exists Xcode 4. As a work-around I did something like this to the main() function. There are some advantages to this approach when Xcode’s Debug Console is misbehaving.
Using tail -f log-out.txt in Terminal allows one to view stdout output. Or, if you use BBEdit, bbedit –new-window log-out.txt is also an workable solution.
For now, I am considering this a bug in Xcode – and I will continue trying to understand under what conditions it occurs.