XCode Skipping Certain Breakpoints
A weird bug has cropped up over the last few days in which XCode refuses to stop at certain breakpoints in my project. And it seems to be getting worse: files containing breakpoints that caused the debugger to break a few days ago now refuse to break. The debugger just skips right over them. If I place a breakpoint in a file that does work, I can step into the files that don't break.
I've tried everything I can think of:
– The project is set on the "Debug" configuration
- I've cleaned the project
- The target has UNSTRIPPED_PRODUCT = YES, GCC_GENERATE_DEBUGGING_SYMBOLS = YES, GCC_OPTIMIZATION_LEVEL = 0
- I've rebuilt the code-sense index
- Deleted all the breakpoints from the Breakpoints window and re-added the ones I need.
Any suggestions? Its kinda getting annoying having to press Step-Into about 10 times to get to where I need to be.
Thanks,
Adam
I've tried everything I can think of:
– The project is set on the "Debug" configuration
- I've cleaned the project
- The target has UNSTRIPPED_PRODUCT = YES, GCC_GENERATE_DEBUGGING_SYMBOLS = YES, GCC_OPTIMIZATION_LEVEL = 0
- I've rebuilt the code-sense index
- Deleted all the breakpoints from the Breakpoints window and re-added the ones I need.
Any suggestions? Its kinda getting annoying having to press Step-Into about 10 times to get to where I need to be.
Thanks,
Adam
Right. You've already done everything I was about to suggest. Is this 2.2 or 2.1 (or even earlier?) I remember having these strange breakpoint problems back in the olden days.
If nothing else helps, try just removing all the source files from the XCode project, clean it, and re-add the sources again...
If nothing else helps, try just removing all the source files from the XCode project, clean it, and re-add the sources again...
Thanks for the tips.
I'm running 2.1 so I'll try upgrading to 2.2, since I should do that anyway, and then see what happens.
I'm running 2.1 so I'll try upgrading to 2.2, since I should do that anyway, and then see what happens.
I had this problem recently, I had to re-create the project and drag the source files back in.
Ok. I've upgraded to XCode 2.2 and re-created the project. Neither of which has fixed the problem. What am I doing wrong?
Wow. My next proposition is for you to throw holy water at it and see if it makes a sound.
Question: when you load GDB, does the console say "File not found: Source.cpp" or something like it?
Question: when you load GDB, does the console say "File not found: Source.cpp" or something like it?
Oh, and also: some places aren't really possible to put breakpoints in, such as some inlined methods and stuff. Could you post an example of a non-working breakpoint?
Fenris Wrote:Question: when you load GDB, does the console say "File not found: Source.cpp" or something like it?No. There are no errors reported by GDB. Using 'info b' to display the list of breakpoints shows them as all being resolved to an address.
Fenris Wrote:Oh, and also: some places aren't really possible to put breakpoints in, such as some inlined methods and stuff. Could you post an example of a non-working breakpoint?Breakpoints work within main(...) and application_event_handler(...) (my carbon event handler), both of which are located in main.cpp.
Code:
BearEngineCore::BearEngineCore() {
this->archiveC = new ArchiveComponent(); // line with breakpoint
//new GraphicsComponent();
}
The thing is, I can step through all of my code correctly, but breakpoints inside my classes no longer (as in they used to work!) cause the debugger to break.
What the hell!!

Cheers,
Adam
On further investigation, it appears as if breakpoints in class constructors fail to break in XCode. The address of the breakpoint is quite a bit different to the address of the PC at the start of the function.
A google search reveled this...
Which sounds exactly like whats happening to me.
Any known workarounds, apart from calling another function from within the constructor?
Thanks,
Adam
A google search reveled this...
Quote:Also, there is a known bug with breakpoints in C++ constructors.
There are two constructors (and two destructors) created for each
class (having to do with subclassing), and when you set the
breakpoint in the constructor, you are setting it in only one ... if
that's not the one that's called, you're SOL.
Which sounds exactly like whats happening to me.
Any known workarounds, apart from calling another function from within the constructor?
Thanks,
Adam
Matrix Wrote:On further investigation, it appears as if breakpoints in class constructors fail to break in XCode.
This is what I'm seeing too. It won't stop at a breakpoint in a constructor. Setting one where the object is created with new and stepping into the constructor is one way to work around this.
KenD
CodeBlender Software - http://www.codeblender.com