views:

166

answers:

1

I have been searching for an hour or so here and on Google and cant find the answer as to how correct breakpoints being shifted during run. I have reinstalled Xcode(3.2.2), insured load lazily is off, no optimization in target settings, and every other target setting that might cause the problem. I have also destroyed all of the user project files (except for the main .pro file) and nothing seems to correct this. Yes, I am running with breakpoints on. Yes, I have done clean builds.

When I set a breakpoint, in the debugger the break stops two or 3 (or more lines) down in the source code, single stepping continues to show the wrong line. Also, in the debugger window the dark blue breakpoint symbol is gone, it does appear in an editor window.

This is driving me batty.

+1  A: 

Sometimes Xcode gets confused about line numbering when your source files have inconsistent line endings, e.g. because you've been using different editors and may have a mixture of different line endings in your source file. You can use a tool like BBEdit or its free sibling TextWrangler to fix this problem.

Paul R
Nope, i went thru and verified the line endings, they are all Unix, UTF-8 text files. Problem still exists.
tgunr
Just to clarify: when I say inconsistent line endings, I mean that you can have a situation where you have a mixture of different line endings *within* a given source file. I get this all the time, e.g. where colleagues have been using a Windows text editor to make changes to a file with Unix line endings. I'm not saying that this is what you necessarily have, but I just wanted to make sure that I made myself clear about the exact nature of the problem.
Paul R
Yes, I understood what you meant and did indeed insure the line endings were consistent. I only use Xcode and Emacs on my source code and no one else has mucked with the code. I still have not tracked down the issue yet. It seems the higher level stack frames point to the correct places, it is only the immediate and previous frame which point incorrectly.
tgunr
OK - one other thing to try: switch from DWARF debug info to Stabs (or vice versa).
Paul R
The problem was the code was being optimized in a target build setting. I had optimization turned off at the project level but didn't noticed the target setting.
tgunr