lldb 3.9 will have to be built for this distro.
First the prerequisites:
sudo yum install centos-release-SCL epel-release sudo yum install cmake cmake3 gcc gcc-c++ git libicu libunwind make python27 tar wget which zip sudo yum install doxygen libedit-devel libxml2-devel python-argparse python-devel readline-devel swig xz
Now build and install llvm/lldb 3.9 using the script provided here: build-install-lldb.sh.
WARNING: This script installs llvm and lldb as root (via sudo) and may overwrite any previously installed versions.
cd $HOME git clone https://github.com/dotnet/diagnostics.git $HOME/diagnostics/documentation/lldb/centos7/build-install-lldb.sh
This will take some time to complete. After the build is finished, run these commands to remove the no longer needed packages:
sudo yum remove doxygen libedit-devel libxml2-devel python-argparse python-devel readline-devel swig xz sudo yum clean all
To launch lldb:
.NET Core Diagnostics Repo
This repository contains the source code for various .NET Core runtime diagnostic tools. It currently contains SOS, the managed portion of SOS, the lldb SOS plugin and various global diagnostic tools. The goals of this repo is to build SOS and the lldb SOS plugin for the portable (glibc based) Linux platform (Centos 7) and the platforms not supported by the portable (musl based) build (Centos 6, Alpine, and macOS) and to test across various indexes in a very large matrix: OSs/distros (Centos 6/7, Ubuntu, Alpine, Fedora, Debian, RHEL 7.2), architectures (x64, x86, arm, arm64), lldb versions (3.9 to 9.0) and .NET Core versions (2.1, 3.1, 5.0.x).
Another goal to make it easier to obtain a version of lldb (currently 3.9) with scripts and documentation for platforms/distros like Centos, Alpine, Fedora, etc. that by default provide really old versions.
This repo will also allow out of band development of new SOS and lldb plugin features like symbol server support for the .NET Core runtime and solve the source build problem having SOS.NETCore (managed portion of SOS) in the runtime repo.
See the GitHub Release tab for notes on SOS and diagnostic tools releases.
在 linux 上调试 .NET Core 一般使用 lldb (gdb 也可以但是没有 SOS 插件支持)，SOS 插件的源代码被搬到了 diagnostics 仓库，所以我们还需要下载编译这个仓库的源代码。
下载编译 diagnostics 仓库 (LLDB SOS 插件）
安装 LLDB 与 LLDB 的开发文件：
apt-get install clang llvm lldb liblldb-3.9-dev
下载编译 diagnostics 仓库：
git clone https://github.com/dotnet/diagnostics cd diagnostics ./build.sh
/diagnostics/artifacts/bin/Linux.x64.Debug/libsosplugin.so 找到 SOS 插件的 dll 文件。