Visual Studio integration for LLDB
February 1, 2021 ยท View on GitHub
This code integrates LLDB remote debugging into Microsoft Visual Studio. This extension is developed and maintained by the Stadia team.
Prerequisites
-
Download and install the latest Stadia SDK from the Stadia Partner Resource Center.
-
Check out the vsi-lldb source code. We recommend to start from the tag that corresponds to the SDK version number you installed, for example:
git checkout tags/1.57 -b <branch-name> -
Initialize the required submodules:
git submodule init git submodule update -
Make sure the following tools are installed on your system (minimal recommended version is specified in parenthesis):
- CMake (>= 3.16.0)
- Ninja (>= 1.8.2)
- Python 3 (>= 3.7)
- SWIG (>= 4.0.2)
- Visual Studio 2017 (>= 15.9.15) or Visual Studio 2019 (>= 16.6.3).
Build Clang and LLDB
-
(Optional) Apply the recommended patches:
cd llvm-project git apply ../patches/llvm-project/*.patch # Use "git am" to import as commitsThese patches are not required, but they fix some bugs and performance issues.
-
Open the
x64 Native Tools Command Prompt for VS 2017(or 2019 if you plan to use only VS 2019). -
Create a build directory inside
llvm-project. Assuming yourvsi-lldbproject is located inC:\Projects:cd C:\Projects\vsi-lldb\llvm-project mkdir build_x64_optdebug cd build_x64_optdebug -
Run the following command (modify
CMAKE_INSTALL_PREFIX,PYTHON_HOME,SWIG_DIRandSWIG_EXECUTABLEaccordingly):cmake ^ -DCMAKE_INSTALL_PREFIX='.' ^ -DLLVM_ENABLE_PROJECTS='lldb;clang;lld' ^ -DPYTHON_HOME=%LOCALAPPDATA%\Programs\Python\Python37 ^ -DSWIG_DIR=C:\Swig ^ -DSWIG_EXECUTABLE=C:\Swig\swig.exe ^ -DLLDB_ENABLE_PYTHON=1 ^ -DCMAKE_BUILD_TYPE=RelWithDebInfo ^ -DLLVM_USE_CRT_RELWITHDEBINFO=MT ^ -GNinja ^ ../llvm -
Run the build:
ninja install
Build & Run vsi-lldb
- Open
Build.propsfile located in the root of the project and make surePythonDiris pointing to the Python used to build LLDB andPythonVersionis correct. - Import
vsi-lldb.slnin your Visual Studio. - Choose
Debug2017orDebug2019as a Solution Configuration depending on your VS version. - Make sure
YetiVSIis selected as a startup project. - Build & Run the solution.
Note: if you are using the Stadia for Visual Studio extension distributed with
the Stadia SDK, make sure to disable or uninstall it before debugging with the
open-source version of the extension. Only one of these extensions should be
active at each moment in order for the debugger to work.
Troubleshooting
Attaching to a remote process is slow
Upon the attach to a remote process the debugger may need to download some data
(e.g. process binary, shared libraries, debug symbols). We recommend applying
the following patch to improve the download speed --
patches/llvm-project/0001-increase-buffer-size.patch.
Disclaimer
This is not an officially supported Google product.