I tried the solution today and would like to post a correction:
Using the --relative-to-command-file or -c flag will then expect a Python module name, which needs to be located directly next to the command file.
Demonstrating with examples:
$(SRCROOT)/.lldbinit with the following content: command script import --relative-to-command-file ./lldb/type_formatters.py
Will result in an error: error: module importing failed: Python does not allow dots in module names: ./lldb/type_formatters
$(SRCROOT)/lldb/.lldbinit with the following content: command script import --relative-to-command-file type_formatters
Will result in a successful import
$(SRCROOT)/.lldbinit with the following content: command script import lldb
Will succeed if $(SRCROOT)/lldb is a Python module, denoted with a __init__.py file at $(SRCROOT)/lldb/__init__.py
Further python modules then can be imported with command script import <module_name> which live under $(SRCROOT)/lldb
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: