Okay, this is issue has been haunting me for the last few days, and there is literally nothing on the internet that would help - but I finally figured it out! Kinda accidentally - I fiddled with stuff and now it works for some completely mysterious reason.
This is for Xcode 8 - macOS Sierra - mid 2010 computer
The Issue:
break points work for the main cpp file, but breakpoints are not working for any included files - cpp files included with "#include".
lldbinit settings do nothing to improve the situation.
Symptoms:
Run the program with some new breakpoints created in the included files, and then press the pause key in the xcode debugger.
In the LLDB console (bottom right of the screen), type:
breakpoint list
You'll see all your broken breakpoints say "location = 0 (pending)" at the end of them. If you add a working breakpoint from you main file, you will see it says "location = 1".
Solution:
In the Project manager, click on the main project file, then click on your Target, goto "Info" - since I'm assuming you're able to build properly, you will have the path to your
build.sh file in the Build Tool box. But make sure the Directory box is empty (My arguments box is also empty, but I doubt this is related.)
Once that Directory box is empty,
build.sh will no longer work because it won't be able to find your file. To fix this, hardcode your paths like so:
| clang++ -g -I/usr/local/include/SDL2 -lSDL2 /absolute/path/to/sdl_mygame.cpp -o /absolute/path/to/mygameexecutable
|
Now the build works, and mysteriously, now your breakpoints all work!
Other notes about my setup:
I created this project as an External Build
I created a target which points to my build file and unchecked "Pass build settings in environment"
I selected this target in my Scheme under Build.
I selected the executable in my scheme under run and checked Debug Executable
Most other xcode settings don't seem to be necessary.
Hope this helps!