Skip to content

Instantly share code, notes, and snippets.

@michalpelka
Last active February 9, 2023 17:12
Show Gist options
  • Save michalpelka/e6ebbeb068c3b5e35bb387108c92859b to your computer and use it in GitHub Desktop.
Save michalpelka/e6ebbeb068c3b5e35bb387108c92859b to your computer and use it in GitHub Desktop.

Setup VSCode and Debug Open 3D Engine with LLDB

VSCode allows to development of CMake applications and gives a full debugging experience.

Please follow the installation guide using the Debian package:

Visual Studio Code - Code Editing. Redefined

System components

sudo apt-get install lldb

VSCode Extensions

Please install the following extension from its market place.

  • C/C++ for Visual Studio Code
  • CMake For VisualStudio Code
  • CMake Tools
  • CodeLLDB

Importing CMake O3DE project to VSCode

Open the folder (File, Open Folder …) and navigate to the root directory of the O3DE project. Alternatively, cd to project root and execute code there:

michal@michal-AORUS-15P-XD:~$ cd ~/github/o3de-physics-test-scene/
michal@michal-AORUS-15P-XD:~/github/o3de-physics-test-scene$ code .

Next choose ‘Yes, I trust authors’, and create directory called .vscode in the project root:

michal@michal-AORUS-15P-XD:~/github/o3de-physics-test-scene$ mkdir -p .vscode
michal@michal-AORUS-15P-XD:~/github/o3de-physics-test-scene$ touch .vscode/settings.json
michal@michal-AORUS-15P-XD:~/github/o3de-physics-test-scene$ touch .vscode/launch.json

Sample configurations :

settings.json

{
    "cmake.buildDirectory": "${workspaceFolder}/build/",
    "cmake.parallelJobs": 14,
    "cmake.defaultVariants": {
        "buildType": {
            "default": "profile",
            "description": "The build type.",
            "choices": {
                "profile": {
                    "short": "Profile",
                    "long": "Optimize for debug and run.",
                    "buildType": "profile"
                }
            }
        }
    },
    "python.linting.enabled": false
}

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug Editor",
            "program": "${workspaceRoot}/build/bin/profile/Editor",
            "args": [],
            "cwd": "${workspaceFolder}"
        }

    ]
}

The former is a project setting with a profile for CMake, latter is debug/launch configuration.

Next, click cmake in the bottom :

image

and select “Profile” variant in the menu:

image With that being done, the CMake should configure build space in build directory:

michal@michal-AORUS-15P-XD:~/github/o3de-physics-test-scene$ ls build
Azcg  BenchmarkResults  bin  build.ninja  cmake  CMakeCache.txt  CMakeFiles  cmake_install.cmake  compile_commands.json  _CPack  CPackComponents.cmake  CPackConfig.cmake  CPackSourceConfig.cmake  CTestTestfile.cmake  DartConfiguration.tcl  _deps  External  lib  o3de  packages  runtime_dependencies  Testing  unit_test_modules.json

Next, build the project by clicking Build in the bottom bar.

Note, that without DLY_STRIP_DEBUG_SYMBOLS the build will be huge ~120 GB. Make some room!

With the build finished, choose Run And Debug and Choose Debug Editor

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment