Skip to content

Building on MacOS

Anton Hromov edited this page Jan 3, 2022 · 7 revisions

On MacOS debugging of C++ code is possible by using lldb debugger. Open Image Debugger is using python interface of lldb for getting debug variables.

In order to properly compile the plugin, you must make sure it is linked against the same python binary used by lldb. Depending on the IDE you're using you may interact with different versions of lldb command. Note that some lldb assemblies use the python library while others use the python framework.

In order to proceed, you have to discover two paths:

  • python include directory
  • python library file OR framework directory

Instructions for python discovery for different lldb versions:

Finally, you can proceed with the normal compilation instructions. Insert discovered python paths in cmake command. Don't use sudo during installation

  1. Download repository and its submodules
git clone https://github.com/OpenImageDebugger/OpenImageDebugger.git
cd OpenImageDebugger
git submodule init
git submodule update
  1. Create build directory
mkdir build && cd build
  1. Configure CMake. Use one of these commands depending on the way of python binary loading by lldb:

    3.1. If lldb uses python library

    cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr/local/bin -DAPPLE_LLDB_PYTHON3_INCLUDE_DIR="__insert_discovered_python_include_directory_path__" -DAPPLE_LLDB_PYTHON3_LIBRARY="__insert_discovered_python_library_file_path__"
    

    3.2. If lldb uses python framework

    cmake .. -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr/local/bin -DAPPLE_LLDB_PYTHON3_INCLUDE_DIR="__insert_discovered_python_include_directory_path__" -DAPPLE_LLDB_PYTHON3_FRAMEWORK_DIR="__insert_discovered_python_framework_directory_path__"
    
  2. Build and install project

make -j4
make install
  1. Now let's test it (only in case of system-wide lldb):
c++ ../testbench/main.cpp -std=c++11 -g -o test
lldb test
command script import /usr/local/bin/OpenImageDebugger/oid.py
break set -f main.cpp -l 344
run
  1. As lldb hits the breakpoint, the Open Image Debugger window should open, and you should be able to inspect the available symbols.

Clone this wiki locally