delve/Documentation/api
Stefan Haller f8c8b33da3
Show pprof labels in thread names (#3501)
* Add pprofLabelForThreadNames config

The config is a string value that indicates the key of a pprof label whose value
should be shown as a goroutine name in the threads view.
2023-12-04 15:44:10 +01:00
..
dap Show pprof labels in thread names (#3501) 2023-12-04 15:44:10 +01:00
json-rpc Fix broken link to JSON-RPC (#2348) 2021-02-21 07:48:12 +01:00
ClientHowto.md Documentation: fix typo and grammar issues (#3291) 2023-02-28 14:52:52 +01:00
README.md Documentation: add DAP API page (#2856) 2022-01-06 08:58:08 -08:00

Server/Client API Documentation

Delve exposes two API interfaces, JSON-RPC and DAP, so that frontends other than the built-in terminal client, such as IDEs and editors, can interact with Delve programmatically. The JSON-RPC API is used by the terminal client, and will always stay up to date in lockstep regardless of new features. The DAP API is a popular generic API already in use by many tools.

Usage

In order to run Delve in "API mode", simply invoke with one of the standard commands, providing the --headless flag, like so:

$ dlv debug --headless --api-version=2 --log --log-output=debugger,dap,rpc --listen=127.0.0.1:8181

This will start the debugger in a non-interactive mode, listening on the specified address, and will enable logging. The logging flags as well as the server address are optional, of course.

Optionally, you may also specify the --accept-multiclient flag if you would like to connect multiple JSON-RPC or DAP clients to the API.

You can connect to the headless debugger from Delve itself using the connect subcommand:

$ dlv connect 127.0.0.1:8181

This can be useful for remote debugging.

API Interfaces

Delve has been architected in such a way as to allow multiple client/server implementations. All of the "business logic" as it were is abstracted away from the actual client/server implementations, allowing for easy implementation of new API interfaces.

Current API Interfaces