Currently, I am using Xcode to develop iOS projects. How can I customize the lldb environment for my project?
I created a. ldbinit file in the project folder, which contains the following settings:
Settings set target. executable search paths/Users/xxx/Desktop/lldb/llvm project/lldb_ Xcode/Debug/bin/lldb
Set debugger "/Users/xxx/Desktop/lldb/llvm project/lldb_xcode/Debug/bin/lldb"
But it didn't take effect, and in the end, the Xcode Launch log displayed:
Using LLDBRPC, LLDB framework is from/Applications/Xcode14.2.app/Content/SharedFrameworks
lldb itself has two places it will look for startup scripts, in the user's home directory (~/.lldbinit) and in the CWD of the debugger. The latter is off by default for security reasons, but is also not all that helpful for GUI apps, where you don't really know where the CWD is (and is usually something not helpful like
/.)lldb supports another convention that's useful in this context. If the lldb framework is running in an app called, for instance
Xcode, then if there's a startup file in the user's home directory called:~/.lldbinit-Xcodethat will be read in preference to~/.lldbinit. That way you can customize lldb differently for command-line and Xcode usage.Finally, starting several versions ago, Xcode added support for Target specific lldb startup files. If you edit the Run Scheme of your Xcode target, in the Info tab there's an entry for LLDB Init File. If you put the path to your lldbinit file there (it can be relative to the project using
$(SRCROOT)to indicate the project source location) Xcode will use that in preference to the others when running that particular target.