trufflesuite / truffle-debugger

Core functionality for debugging Solidity files built with Truffle
67 stars 12 forks source link

truffle-debugger


:warning: This repo is deprecated :warning:

Truffle has moved all modules to a monorepo at trufflesuite/truffle. See you over there!


Portable Solidity debugger library, for use with or without Truffle.

Debugger in Action

Features:

API Documentation

API Documentation for this library can be found at truffleframework.com/truffle-debugger.

Library Usage

:warning: This documentation is currently a work in progress. Please see the reference integration provided by the truffle debug command.

Required Parameters

To start a truffle-debugger session, you'll need the following:

Optionally (and recommended), you can also provide a files argument:

Invocation

  1. Start the debugger session by constructing a Debugger instance with .forTx() and then .connect() to it:
import Debugger from "truffle-debugger";

let bugger = await Debugger
  .forTx(txHash, { contracts, files, provider });

let session = bugger.connect();
  1. Resolve the session's ready() promise:
await session.ready();
  1. Use the provided public methods on the session instance in order to step through the trace for the transaction:
session.stepNext();
session.stepOver();
session.stepInto();
  1. Access data provided by the debugger via the session.view() interface, and the provided selectors:
let { ast, data, evm, solidity, trace } = Debugger.selectors;

let variables = session.view(data.current.identifiers.native);
let sourceRange = session.view(solidity.current.sourceRange);

Useful API Docs References

Contributing

It's our goal that this library should serve as a reliable and well-maintained tool for the Solidity ecosystem. Ultimately, we hope to support all language features and meet the varied requirements of a mature debugging library.

We believe that a good Solidity debugger belongs to the community. We welcome, with our most humble gratitude, any and all community efforts in bringing this debugger closer to that goal. If you find something broken or missing, please open an issue!

Some other ideas for how to get involved:

Thank you for all the continued support. :bow: