delvejs

0.2.6 • Public • Published

Delvejs

Provides a Node.js interface with a Delve debugger server using it's JSON-RPC API. Note that this library does not handle creating a delve process and managing it, only connecting to an existing server. Though this means that this can be used to attach to debug sessions over a network.

Usage

Start a Delve debugging session in headless mode listening on a host & port:

$> dlv debug --headless=true --listen="localhost:8181"

To connect from an application:

const Delve      = require('delve');
const DelveError = require('delve').Error;

// initialize a new Delve client
let delveClient = new Delve('localhost', 8181);

// switch over to a socket connection
delveClient.establishSocketConn()

// set a breakpoint
.then(() => delveClient.createBreakpoints('mybp', 'main.go:1')

// continue to the breakpoint
.then(() => delveClient.continueToNextBreakpoint())

// exit the debugging session, kill the debugger process too
.then(() => delveClient.detach(true))

// catch any Delve errors
.catch(DelveError.DelveServerError, err => console.error(err))

// close the connection to the server
.finally(() => delveClient.endSession());

To see the full list of commands look at the source in delve.js. Note that with the exception of functions that return breakpoints many methods will return the data structures returned by the Delve JSON-RPC API verbatim, for a full list of types see the Delve API type definitions here.

TODO

  • Write tests.. somehow

Dependencies (2)

Dev Dependencies (4)

Package Sidebar

Install

npm i delvejs

Weekly Downloads

3

Version

0.2.6

License

MIT

Last publish

Collaborators

  • tylerfowler