Netcoredbg
NetCoreDbg is a managed code debugger with GDB/MI, VSCode DAP and CLI interfaces for CoreCLR.
Install / Use
/learn @Samsung/NetcoredbgQuality Score
Category
Development & EngineeringSupported Platforms
README
Debugger for the .NET Core Runtime
The NetCoreDbg debugger implements GDB/MI and VSCode Debug Adapter Protocol in a unified framework, allowing the debugging of .NET apps under the .NET Core runtime as well as facilitating debugging from the command line (such as in GDB).
Copyright
You can find licensing information in the LICENSE file within the root directory of the NetCoreDbg sources.
Usage
Further details regarding the usage of NetCoreDbg can be found in the CLI manual.
Installation
NetCoreDbg is available in repositories of some Linux distributions and Windows package manager:
- Arch Linux (https://aur.archlinux.org/packages/netcoredbg)
- Gentoo Linux (https://packages.gentoo.org/packages/dev-dotnet/netcoredbg)
- LiGurOS (https://gitlab.com/liguros/liguros-repo/-/tree/develop/dev-dotnet/netcoredbg?ref_type=heads)
- NixOS (https://mynixos.com/nixpkgs/package/netcoredbg)
- Scoop (Windows) (https://github.com/ScoopInstaller/Main/blob/master/bucket/netcoredbg.json)
For other Linux distributions you can use binaries provided in github releases (https://github.com/Samsung/netcoredbg/releases) or build from source code.
Building from Source Code
Currently, NetCoreDbg can be built on Linux, MacOS, or Windows. Instructions for building NetCoreDbg on each platform is shown below.
Supported Architectures
- ARM 32-bit
- ARM 64-bit
- x64
- x86
- RISC-V 64-bit
- LoongArch 64-bit
Unix
NetCoreDbg's build requires Microsoft's .NET, and as such, NetCoreDbg can only be built in Linux. Microsoft supports a few distributions, the details of which can be found here: https://docs.microsoft.com/en-us/dotnet/core/install/linux.
Prerequisites
-
You need to install
cmake, and eithermakeorninja. -
You need the clang C++ compiler installed (NetCoreDbg can't be built with gcc).
-
Microsoft's .NET runtime should be installed, which you can download here: https://dotnet.microsoft.com/download.
-
You may also need to install some common developers tools not mentioned here, such as Git, etc...
-
It is expected that you place the NetCoreDbg sources within a directory.
-
Optional step: NetCoreDbg requires the CoreCLR runtime source code, which is typically downloaded automatically, but can also be downloaded manually from here: https://github.com/dotnet/runtime.
For example, you can check out tag v8.x.
-
Optional step: NetCoreDbg requires the .NET SDK, which is typically downloaded automatically, but can also be downloaded manually from here: https://dotnet.microsoft.com/download.
Compiling
Configure the build with the following commands:
user@netcoredbg$ mkdir build
user@netcoredbg$ cd build
user@build$ CC=clang CXX=clang++ cmake ..
In order to run tests after a successful build, you need to add the option -DCMAKE_INSTALL_PREFIX=$PWD/../bin.
To enable the Source-Based Code Coverage feature (https://clang.llvm.org/docs/SourceBasedCodeCoverage.html),
add the -DCLR_CMAKE_ENABLE_CODE_COVERAGE option.
If you have previously downloaded the .NET SDK or CoreCLR sources, then you should modify the command line by adding the following options:
-DDOTNET_DIR=/path/to/sdk/dir -DCORECLR_DIR=/path/to/coreclr/sources.
If cmake tries to download the .NET SDK or CoreCLR sources and fails, then please see bullet numbers 6 and 7 above. You can download any required files manually.
After configuration has finished, you can then build NetCoreDbg:
user@build$ make
...
user@build$ make install
To perform a build from scratch, including the configuration step, you should again delete any artifacts with the following commands:
user@build$ cd ..
user@netcoredbg$ rm -rf build src/debug/netcoredbg/bin bin
Directory
bincontains "installed" NetCoreDbg's binaries for tests. If you have installed NetCoreDbg in other places, for example in/usr/local/bin, you should remove it manually because NetCoreDbg's build system doesn't currently implement automatic uninstalling.
Prerequisites and Compiling with Interop Mode Support (Linux and Tizen OSes only)
The prerequisites and compiling process are the same as the aforementioned with the following changes:
-
Depending on your distro, you need to install either the
libunwind-devorlibunwind-develpackages. -
Configure the build with the following commands:
user@build$ CC=clang CXX=clang++ cmake .. -DINTEROP_DEBUGGING=1
To find more details on the usage of NetCoreDbg in Interop Mode, please see the guide doc: Interop Mode.
MacOS
You need to install homebrew from here: https://brew.sh/
After this, the build instructions are the same as for Unix, including the prerequisites.
Note: the MacOS arm64 build (M1) is community supported and may not work as expected, as well as some tests possibly failing.
Windows
Prerequisites:
-
Download and install CMake from here: https://cmake.org/download
-
Download and install Microsoft's Visual Studio 2019 or newer from here: https://visualstudio.microsoft.com/downloads
During installation of Visual Studio you should install all of the options required for C# and C++ development on Windows.
-
Download and install Git; you have a few options here:
- use original Git: https://git-scm.com/download/win
- use TortoiseGit: https://tortoisegit.org/download
- or use git installed in cygwin: https://cygwin.com/install.html
-
Utilize Git to place NetCoreDbg sources in a directory.
-
This step may be omitted, and in that case, cmake will automatically download all necessary files. But if it fails, you then need to manually download the CoreCLR sources into another directory from here: https://github.com/dotnet/runtime.
For example, you can use the latest tag v8.x.
-
This step may also be omitted, and in that case, cmake will automatically download all necessary files. But if it fails, you then need to manually download and install the .NET SDK from here: https://dotnet.microsoft.com/download
Compiling
Configure the build with the following commands given in NetCoreDbg's source tree:
C:\Users\localuser\netcoredbg> md build
C:\Users\localuser\netcoredbg> cd build
C:\Users\localuser\netcoredbg\build> cmake .. -G "Visual Studio 16 2019"
Note: You should run this command from cmd.exe, not from cygwin's shell.
Option -G specifies which instance of Visual Studio should build the project.
Note, the minimum requirements for NetCoreDbg's build is the Visual Studio 2019 version.
If you want to run tests after a successful build, then you should add the following option: -DCMAKE_INSTALL_PREFIX="%cd%\..\bin".
If you have downloaded either the .NET SDK or .NET Core sources manually, you should add the following options:
-DDOTNET_DIR="c:\Program Files\dotnet" -DCORECLR_DIR="path\to\coreclr"
To compile and install, use the following command:
C:\Users\localuser\netcoredbg\build> cmake --build . --target install
To perform a build from scratch, including the configuration step, you should again delete any artifacts by using the following commands:
C:\Users\localuser\netcoredbg\build>cd ..
C:\Users\localuser\netcoredbg>rmdir /s /q build src\debug\netcoredbg\bin bin
Directory
bincontains the "installed" NetCoreDbg's binaries for tests. If you have installed NetCoreDbg in other places, you should remove it manually because NetCoreDbg's build system doesn't currently perform automatic uninstalling.
Running NetCoreDbg
In the instructions provided above, the netcoredbg binary and additional libraries will be installed in some directory.
For development purposes (for running tests, debugging, etc...), the directory bin in NetCoreDbg's source tree is typically used.
Now, running the debugger with the --help option should look like this:
$ ../bin/netcoredbg --help
.NET Core debugger
Options:
--buildinfo Print build info.
--attach <process-id> Attach the debugger to the specified process id.
--interpreter=cli Runs the debugger with Command Line Interface.
--interpreter=mi Puts the debugger into MI mode.
--interpreter=vscode Puts the debugger into VS Code Debugger mode.
--command=<file> Interpret commands file at the start.
-ex "<command>" Execute command at the start
--run Run program without waiting commands
--engineLogging[=<path to log file>] Enable logging to VsDbg-UI or file for the engine.
Only supported by the VsCode interpreter.
--server[=port_num] Start the debugger listening for requests on the
specified TCP/IP port instead of stdin/out. If port is not specified
TCP 4711 will be used.
--log[=<type>] Enable logging. Supported logging to file and to dlog (only for Tizen)
File log by default. File is created in 'current' folder.
--version Displays the current version.
Basically, to debug .NET code, you should run NetCoreDbg with the following command line:
$ /path/to/netcoredbg --interpreter=TYPE -- /path/to/dotnet /path/to/program.dll
Notes for Developers
Running the Tests
Detailed instructions on how to run tests can be found in the test-suite directory here: test-suite/README.md.
You simply need to build and install NetCoreDbg into the bin directory (in the NetCoreDbg source tree) and then change the directory to test-suite and run the following script /run_tests.sh
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
