Giter Club home page Giter Club logo

pmd's Introduction

Poor's man debugger

๐Ÿšง Under development, it works but some stuff might change in the future.


The most simple way to debug your code.

This is a simple TUI debugger, it starts a local server that accepts payloads from the adapters. Everything goes through HTTP requests, so it's very fast compared to other solutions. You can think of it as a console.log(), but instead of the browser you use the terminal and it works with any language.

_zsh_tmux_plugin_run 2022-04-29 15-28-12

Requirements

  • PMD-adapter for your language installed in the project.

Installation

You can install it via cargo.

  1. Install cargo (https://doc.rust-lang.org/cargo/)
  2. Run cargo install pmd

Configuration

The default config is located at ~/.config/pmd/config.toml (for UNIX like systems) or ~/.pmd/config.toml (for Windows).

You can override the default config by passing a -c (--config) flag that points to the config.toml file.

Keybindings

Keybindings are VIM-like. The leader key is set by default to , , but you can override this via config.

Debugger consists of three input states

  • Normal
  • Visual
  • Inspection

Normal

Normal mode enables you to scroll all the breakpoints and callstack data.

It has the following keybindings:

  • j (or Down arrow) -> Move down the list
  • k (or Up arrow) -> Move up the list
  • <leader> + h -> Move to the left
  • <leader> + l -> Move to the right
  • i -> Set inspection mode, to inspect the dumped variables
  • v -> Set visual mode and open the selected breakpoint/callstack in a popup for more details.
  • q -> Quit

Visual

Visual mode is meant to show additional data that are not present in normal mode for breakpoints/callstack.

It has the following keybindings:

  • q -> Quit
  • ESC -> Go to normal mode

Inspection

Inspection mode enables you to inspect the tree-like data that were sent by the adapters.

It has the following keybindings:

  • j (or Down arrow) -> Move down the tree
  • k (or Up arrow) -> Move up the tree
  • h -> Close the selected item
  • l -> Expand selected item.
  • q -> Quit
  • ESC -> Go to normal mode

Adapters

Adapters are language specific packages that sends the actual debug data to PMD via HTTP.

Currently supported

Adapter API

An example API for an adapter

curl --request POST \
  --url http://localhost:6969/dump \
  --header 'Content-Type: application/json' \
  --data '{
        "timestamp": "3223232",
        "line": "6",
        "connector_type": "php",
        "filepath": "/home/project/drupal/web/index.php",
        "callstack": [
                {
                        "filepath": "/home/project/drupal/web/index.php",
                        "line": "10"
                }
        ],
        "payload": ""
}'

Types:

  • timestamp -> String
  • line -> String
  • connector_type -> String
  • filepath -> String
  • callstack -> Array (where key is a line number (int), and value is a file path (string)
  • payload -> JSON encoded string

Security Vulnerabilities

For any security vulnarabilities please send an email to [email protected]

Credits

License

The MIT License (MIT). Please see License File for more information.

pmd's People

Contributors

nkoporec avatar

Watchers

 avatar  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.