XCode Skipping Certain Breakpoints

Apprentice
Posts: 17
Joined: 2005.05
Post: #1
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
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #2
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...
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2005.05
Post: #3
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.
Quote this message in a reply
Member
Posts: 41
Joined: 2006.01
Post: #4
I had this problem recently, I had to re-create the project and drag the source files back in.
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2005.05
Post: #5
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?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #6
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?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #7
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?
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2005.05
Post: #8
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();
}
Placing a breakpoint on the line indicated has no effect on the debugger. The constructor is not inlined. An instance of BearEngineCore is created within application_event_handler(...).

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!! Mad

Cheers,
Adam
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2005.05
Post: #9
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...
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
Quote this message in a reply
Member
Posts: 79
Joined: 2002.08
Post: #10
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
Quote this message in a reply
Post Reply