Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

lldbinit file in Xcode

My ultimate aim is to be able to prevent Xcode from single-stepping into certain C++ functions - just as it does not single-step into std:: functions.

It appears to be possible to arrange this by making a more elaborate version of an LLDB setting such as this:

target.process.thread.step-avoid-regexp (regex) = ^std::

It also appears to be possible to put this setting into an "lldbinit" file so that LLDB (within Xcode) picks up the setting automatically when a debugging session starts.

What I do not know is this:

  • Where do I put the "lldbinit" file inside my project?
  • What Xcode project or target settings need to be made to tell Xcode where to find my "lldbinit" file and use it?
Answered by Developer Tools Engineer in 843249022

I'd like to answer the second question first.

The lldb config file can be selected by editing the Run scheme action.

Specifically, use the menu bar, go to "Product" -> "Scheme". Make sure the desired scheme is selected, and click on "Edit Scheme...".

In the pop up window, select the "Run" action from the column on the left. Then click on the "Info" tab. The lldbinit file can be specified through the field in the middle.

Going back to the first question. Since we can explicitly specify a path to the lldbinit file, we can place it anywhere in the project.

Is this sufficient to get you going? Please let us know and I will follow up. Thanks!

Accepted Answer

I'd like to answer the second question first.

The lldb config file can be selected by editing the Run scheme action.

Specifically, use the menu bar, go to "Product" -> "Scheme". Make sure the desired scheme is selected, and click on "Edit Scheme...".

In the pop up window, select the "Run" action from the column on the left. Then click on the "Info" tab. The lldbinit file can be specified through the field in the middle.

Going back to the first question. Since we can explicitly specify a path to the lldbinit file, we can place it anywhere in the project.

Is this sufficient to get you going? Please let us know and I will follow up. Thanks!

Thank you! I should have noticed that.

For the benefit of anyone else reading this, I have just experimented as follows.

  1. Create a file called lldbinit containing the single line

settings set target.process.thread.step-avoid-regexp ^std::|^string::

  1. Place it in the same directory as my .xcodeproj file

  2. In the field you mentioned in Product > Scheme > Info, I set the "LLDB Init File" field to $(SRCROOT)/lldbinit

And indeed, when single-stepping, it now steps over functions in the string namespace instead of stepping into them.

lldbinit file in Xcode
 
 
Q