Handmade Hero»Forums»Code
2 posts
Xcode (lldb) debugging no breakpoints
Apparently, Xcode (v6.1.1) ignores breakpoints inside #include'd files.
It sets breakpoints with file name and line number, but fails to understand that file is included inside another one and line numbers moved. Has anyone faced this issue?
How do you debug on OS X with unity builds?
Jeff Buck
28 posts
Xcode (lldb) debugging no breakpoints
I ran into this too. There's an easy fix for it, but it's not obvious at all.

Create an ~/.lldbinit file and put this in it:

settings set target.inline-breakpoint-strategy always

See this page on the LLVM site for details:

2 posts
Xcode (lldb) debugging no breakpoints
That's exactly it. Thank you.
Jason Bricco
2 posts
Xcode (lldb) debugging no breakpoints
Edited by Jason Bricco on
Hey there,

Old thread, but I have the same problem and I can't seem to resolve it. I've been trying to follow through with the videos on a Mac but I cannot get Xcode to resolve my breakpoints. It works fine in the base cpp file, but not in any included cpp files.

I did put the "settings set target.inline-breakpoint-strategy always" in the ~/.lldbinit file but it seems to have no effect whatsoever.

If I try to run the file directly, I get told:

"line 1: settings: command not found"

It seems it doesn't even understand the line at all. I have no experience with LLDB nor this file and don't know how it is used or read. Maybe that's just because it has to be called by LLDB instead of directly?

What could I be missing here?

Additional Info:

-To use Xcode as a debugger, I created an empty Xcode project, made a new scheme, and set the run executable to my executable and checked the 'debug executable' option. Then I linked it to my code folder so my code appears in Xcode, and set breakpoints by clicking in the gutter.
-I built with debug mode (generating debug information).
-Everything works fine using LLDB from the terminal, but doesn't work through Xcode.

Thanks for any help!
Tim Kane
23 posts
Twitter: Tim_Rex_
Xcode (lldb) debugging no breakpoints

I did put the "settings set target.inline-breakpoint-strategy always" in the ~/.lldbinit file but it seems to have no effect whatsoever.

If I try to run the file directly, I get told:

"line 1: settings: command not found"

The .lldbinit file is intended only as a configuration file. It's not something you can execute or run directly.
It really should be as simple as adding that single line to it - the next time you use LLDB for a debug session (be it via Xcode or otherwise) if should "just work"..

I just set this up for myself today, and seems good... Sorry I can't be any more helpful than that, obviously it hasn't worked for you :-/ Unless you've since got it working?
Seth Archambault
15 posts
I do mobile app development in Javascript and dream of true native development. Caterpillars are most angry before they become butterflies.
Xcode (lldb) debugging no breakpoints
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.

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".

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!