Git Product home page Git Product logo

avm-debugger's Introduction

AVM Debugger

Summary

This repo contains an AVM debugger which adheres to the Debug Adapter Protocol. This protocol is used by a variety of clients, and this repo additionally implements a basic client for VS Code.

Unlike traditional debuggers, which typically execute code as it is being debugged, this debugger operates on an execution trace. The trace is created by the algod simulate API. This debugger is not responsible for compiling programs, assembling transaction groups, or executing transactions/programs. It is only responsible for replaying the execution trace, which must already exist.

This code is based on the vscode-mock-debug repo.

Usage

There are multiple ways to invoke the debug adapter exported by this package.

CLI

The debug adapter can be invoked from the command line using the avm-debug-adapter command.

If given no arguments, the debug adapter will use stdin and stdout to process messages.

To run as a server, use the --port option, shown below:

$ npm exec avm-debug-adapter -- --port=8080
>> running as a server, listening on 8080

Programmatically

// AvmDebugSession is a vscode.DebugAdapter implementation and can be imported
// directly if you don't want to run it as a server.
import { AvmDebugSession } from 'avm-debug-adapter';

// From node, you can create a debug adapter server like so
import { Server, nodeFileAccessor } from 'avm-debug-adapter/node';

const server = new Server({
  fileAccessor: nodeFileAccessor,
  port: 8080,
  onSocketError: (err) => {
    console.error(err);
  },
  onServerError: (err) => {
    console.error(err);
  },
});

console.log('Server listening on port ' + server.port());

process.on('SIGTERM', () => {
  server.close();
});

Features

See FEATURES.md for a list of features this debugger supports.

Build and Run

  1. Clone the repo.
  2. npm i to install dependencies.
  3. Open the project folder in VS Code.
  4. From the Run and Debug menu, run the Extension configuration to open the AVM Debug extension in another VS Code window.
  5. In the new window, go to its Run and Debug menu to select and launch one of the existing configurations.
  6. You are now in a debugging session of a transaction group. You can step through the transaction group, inspect variables, set breakpoints and more. See FEATURES.md for more details.

avm-debugger's People

Contributors

ahangsu avatar jasonpaulos avatar tonyfloatersu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.