All Projects → strottos → Vim Padre

strottos / Vim Padre

Licence: apache-2.0
Debugger plugin for VIM

Programming Languages

python
139335 projects - #7 most used programming language
rust
11053 projects

Projects that are alternatives of or similar to Vim Padre

debug
Debugging functionality for Ruby
Stars: ✭ 706 (+1580.95%)
Mutual labels:  debugger, debugging-tool
lldb debugger
Helpful commands when using lldb.
Stars: ✭ 27 (-35.71%)
Mutual labels:  debugger, lldb
lldbg
A lightweight native GUI for LLDB.
Stars: ✭ 83 (+97.62%)
Mutual labels:  debugger, lldb
hilda
LLDB wrapped and empowered by iPython's features
Stars: ✭ 99 (+135.71%)
Mutual labels:  debugger, lldb
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+8873.81%)
Mutual labels:  debugger, debugging-tool
nopdb
NoPdb: Non-interactive Python Debugger
Stars: ✭ 67 (+59.52%)
Mutual labels:  debugger, debugging-tool
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-52.38%)
Mutual labels:  debugger, debugging-tool
Vegvisir
A browser based GUI for **LLDB** Debugger.
Stars: ✭ 189 (+350%)
Mutual labels:  debugger, lldb
Vscode Lldb
A native debugger extension for VSCode based on LLDB
Stars: ✭ 866 (+1961.9%)
Mutual labels:  debugger, lldb
Lldb.nvim
Debugger integration with a focus on ease-of-use.
Stars: ✭ 254 (+504.76%)
Mutual labels:  debugger, lldb
gdbundle
Minimalist plugin manager for GDB and LLDB
Stars: ✭ 72 (+71.43%)
Mutual labels:  debugger, lldb
Vuetron
A tool for testing and debugging your Vue + Vuex applications. 是一個可以幫助您 Vue.js 的項目測試及偵錯的工具, 也同時支持 Vuex及 Vue-Router.
Stars: ✭ 531 (+1164.29%)
Mutual labels:  debugger, debugging-tool
Ds2
Debug server for lldb.
Stars: ✭ 243 (+478.57%)
Mutual labels:  debugger, lldb
TrackJS-Node
TrackJS Error Monitoring agent for NodeJS
Stars: ✭ 26 (-38.1%)
Mutual labels:  debugger, debugging-tool
Code Debug
Native debugging for VSCode
Stars: ✭ 232 (+452.38%)
Mutual labels:  debugger, lldb
docker-pudb
Debug Python code within a Docker container remotely from your terminal using pudb
Stars: ✭ 18 (-57.14%)
Mutual labels:  debugger, debugging-tool
Gdb Frontend
☕ GDBFrontend is an easy, flexible and extensionable gui debugger.
Stars: ✭ 2,104 (+4909.52%)
Mutual labels:  debugger, debugging-tool
Frodo2
Android Library for Logging RxJava2 Components
Stars: ✭ 142 (+238.1%)
Mutual labels:  debugger, debugging-tool
madbomber
Backtrace-on-throw C++ exception logger
Stars: ✭ 17 (-59.52%)
Mutual labels:  debugger, debugging-tool
Lldb
Project moved to: https://github.com/llvm/llvm-project
Stars: ✭ 412 (+880.95%)
Mutual labels:  debugger, lldb

VIM PADRE

VIM PADRE was written in order to help debug using the VIM editor. Whilst IDE's have become very popular VIM seems to remain popular (certainly in the authors case) for editing. At the time of writing this there were many debugger plugins for VIM but none that seemed to a) work, b) could debug across multiple languages and c) I could easily extend myself.

This plugin still needs a lot of work but it does work. The idea has been that we rely on an external program to provide a consistent interface for VIM with this program (that I called padre) that does most of the heavy lifting.

Currently padre supports LLDB, Python and Node debuggers with an ambition of adding more. It runs on either Linux or Mac, Windows is currently unsupported.

Here's a demo of it in action: asciicast

How-To

Installation

You can download VIM plugins in a variety of ways. The plugin is written in Rust so make sure you have Rust on your system. If you don't, you can install it via the instructions in https://rustup.rs/.

pathogen

pathogen is my favourite because you just need to add the plugin to ~/.vim/bundle. See here for more details on using pathogen (https://github.com/tpope/vim-pathogen) but essentially you just clone this repository into ~/.vim/bundle. Once you've done this you should cd ~/.vim/bundle/vim-padre and then run make. Really the Makefile is very simple and just handles things off to Cargo (Rust's package manager/build tool).

vim-plug

Add the following to your plugin section:

Plug 'strottos/vim-padre', { 'dir': '~/.vim/plugged/vim-padre', 'do': 'make' }

Running

Once you have VIM PADRE installed you can run a program by doing the following (NB: Do not specify the debugger command with the program you want to run, that's what -d is for):

:PadreDebug -d=/usr/bin/lldb -t=lldb -- ./my_prog arg1 arg2 arg3

You do not need to specify -t and -d and it will try and guess but if it fails to do so you can override the debugger type and debugger command respectively with these options (see Running other Debuggers below).

This will open a new tab in VIM with two open panes, one of which is the terminal command that will run the debugger and the corresponding program and the other of which is the PADRE logs. Initially you will see a log in here saying that PADRE has started, once this log comes up you may use PADRE.

Running other Debuggers

You can specify other debuggers by using the -t and -d options. The -t option (or --type) gives us the ability to choose other debugger types, we currently support lldb, node and python. The -d (or --debugger) option gives us the ability to specify the path for the debugger it will use. You should not specify the debugger as part of the command you are trying to run, so for example, to run an index.js file through node you would run something like:

:PadreDebug -t=node -- ./index.js

Here you have specified that it is a debugger of type node but not where that debugger is, PADRE will guess that the debugger is the first thing in the PATH environment variable with name node in this case.

Using PADRE

Once you have launched PADRE you can then use it. There are PADRE commands for each of the commands but it's more useful to use the keyboard shortcut. When you see the message to say PADRE is open you can type r in that window and it will run the program. It will try and pause the program immediately upon startup and will then (assuming it found the source code) open a new window with the source code in and a green pointer indicating whereabouts the pause occured. In either of these windows (NB: Recommend the code Window for now as there is a bug in the other window at time of writing) you can use the following commands for controlling the flow of the program:

s - Step Over (:PadreStepOver) S - Step In (:PadreStepIn) C - Continue (:PadreContinue)

You can print variables by visually highlighting them and pressing p. You can also set breakpoints by going to the appropriate file and doing either :PadreBreakpoint or by adding the following to your .vimrc and then simply doing -b where you want the breakpoint:

let g:maplocalleader='-'
nnoremap <localleader>b :PadreBreakpoint<cr>

You can of course choose your own letter for doing this but I recommend using a local leader. See here for more details about leaders and local leaders in VIM: http://learnvimscriptthehardway.stevelosh.com/chapters/06.html

Note currently unsetting breakpoints is not supported, this should be added at some point.

You can also interface with the terminal, anything you type in will be forwarded to PADRE and then quite often from there to the Debugger itself (and often onto the program itself).

Layout and Architecture

VIM itself is intended to be as dumb as possible when using PADRE and it simply has a command that spawns a PADRE process and others that simple send responses and listen for simple instructions.

The PADRE process itself is more interesting and more complex. PADRE originally started in Go but that didn't work out so well and I wanted a better and faster prototype so I switched to using Node. Then Node never gave me the power I wanted and frankly I wanted to learn Rust, so this got rewritten in Rust and that's what I'm using now. It uses Tokio to be able to support multiple things happening at once.

You can open a separate connection to PADRE in order to debug it, or run a separate PADRE command on the command line and tell VIM to connect into that.

Issues

There is still a lot of work to be done on this plugin, the debugger since being written in Rust is better now but still some extra error handling wouldn't go amiss, particularly in Node and Python. The VIM interface, however, still needs a lot of work itself, that has quite a few bugs in.

TODOs

Things that we need to add still are as follows (feel free to help if you wish, some are likely to be more challenging than others):

  • Support requesting non-existent files, e.g. assembly for LLDB and internal scripts for Node.
  • Queueing and counting of requests, would be nice to be able to do 3s and it steps over 3 times but without sending 3 commands indicating where it is.
  • Configurably auto step ins till we find code
  • Remove breakpoints
  • Interrupts
  • Support for multi-threading/multi-processing
  • Backtraces
  • Add in preprocessing possibilities like compiling before running PADRE
  • Profiling CPU, mem, etc
  • Proper variable printing, it's mostly a bit simple at the moment
  • Go Debugger
  • Java Debugger
  • Support multiple PADRE processes
  • Make things more configurable
  • Consistent breakpoint setting, can set them before or after running the program and they will still be picked up, works better unders some debuggers than others
  • Upgrade PADRE to use new Tokio/Rust futures/async/await syntax once they're in stable.
  • Allow setting variables to other values
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].