This has often been cause line endings and has been discussed a number of times.
Here was a response I gave some time back to one such question:
We are writing mostly in C and not C++ but we had a similar problem where the breakpoints didn't line up where they were supposed to. It turned out for us the problem was line endings. Especially true if the code comes from another platform. Older Macs used CR for a line ending, PCs use CR LF and Unix uses LF.
I changed the preference in Xcode to use Unix line endings (Text Editing tab).
I was told at one point that highlighting all code in a file and doing a Re-Indent would clean this up. It seemed like it helped but it wasn't perfect. We finally got a copy of BBEdit and created a Text Factory (sounded tough but ended up being trivial). We ran it against all of our code to change all line endings to the Unix line ending (LF). Now are breakpoints stop where we expect them to.
An alternative to using BBEdit is to write a script using Perl or another scripting language but since I haven't used those before I went with the BBEdit option. --------
Other people have commented on other issues that have caused this as well. If I remember correctly the exited Xcode and reran and the problem went away.
Mike
On Jul 29, 2005, at 3:35 PM, Scott Thompson wrote: Somehow I've gotten my machine to the point where the red arrow that indicates the current point of execution in the debugger is off by four or five lines.
This happened earlier in the day and resolved itself after I rebuilt everything.
I've tried cleaning the offending project and rebuilding, but it does not seem to resolve the issue. Any pointer on how I might smack XCode upside the head and make it stop doing what it's doing?
Scott
|