Skip to content

jvalcher/termfu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

530 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

termfu

A multi-language debugger frontend for the Linux terminal

  • Fast
  • Easy to configure
  • Key bindings documented on-screen
  • Switch between custom layouts while debugging
  • Scrollable window data
  • Breakpoint, watchpoint persistence
  • Debugger prompt access


Support

Debugger Languages
GDB C, C++, D, Go, Objective-C, Fortran, OpenCL C, Pascal, Rust, assembly, Modula-2, Ada
PDB Python

Installation

Dependencies

sudo apt-get install make gcc libncurses-dev gdb python3

Build and install

make
sudo make install

Usage

  • The program can be run as follows in the same directory as a .termfu configuration file.
  • Breakpoint and watchpoint data will be stored in .termfu_data.
termfu

Flags

  • -h prints usage instructions.
  • -c sets the configuration file path.
  • -p sets the data persistence file path.
termfu -c .termfu_01 -p .termfu_01_data

Basics

  • Switch between layouts with your (l)ayouts key.
  • Scroll window data by selecting the window via its key binding and then using the arrow, page up, etc. keys. You can also use the hjkl keys.

Configuration

Example .termfu configuration


[ command ]

gdb --interpreter=mi a.out

[ plugins ]

# header commands
AtP : A : (A)ttach
Con : c : (c)ontinue
Fin : f : (f)inish
Kil : k : (k)ill
Lay : l : (l)ayouts
Nxt : n : (n)ext
Nxi : N : (N)exti
Prm : m : pro(m)pt
Qut : q : (q)uit
Run : r : (r)un
Stp : s : (s)tep
Sti : S : (S)tepI
Unt : u : (u)ntil

# windows
Asm : a : (a)ssembly
Brk : b : (b)reakpoints
Dbg : d : (d)ebug out
LcV : v : local (v)ars
Prg : p : (p)rogram out
Reg : g : re(g)isters
Src : o : s(o)urce file
Stk : t : s(t)ack
Wat : w : (w)atch


[ layout : Main ]

>h
rkmlq
nNsScuf

>w
bbbooooo
wwwooooo
vvvooooo
ttpppddd

[ layout : Assembly / Registers ]

>h
rkmlq
nNsScuf

>w
oag
oag
oag
wdt


Resulting layouts


Command

[ command ]

gdb --interpreter=mi a.out

Debugger Command
GDB gdb --interpreter=mi a.out
PDB python -m pdb app.py

Plugins

[ plugins ]

# <plugin code> : <key binding> : <title>

AtP : A : (A)ttach
Con : c : (c)ontinue

  • Each three-character, case-sensitive plugin code corresponds to a specific header command or window.
  • Add parentheses around a key binding in its (t)itle for easy reference. This character will have a different color than the surrounding characters.

Header Commands

Code Description GDB PDB
AtP Attach to PID, file ✔️
Con Continue ✔️ ✔️
Fin Finish ✔️ ✔️
Kil Kill ✔️ ✔️
Lay Choose layout ✔️ ✔️
Nxi Next instruction ✔️
Nxt Next ✔️ ✔️
Prm Debugger prompt ✔️ ✔️
Qut Quit ✔️ ✔️
Run Run, reload program ✔️ ✔️
Sti Step instruction ✔️
Stp Step ✔️ ✔️
Unt Until ✔️ ✔️

Windows

Code Description GDB PDB
Asm Assembly code ✔️
Brk Breakpoints ✔️ ✔️
Dbg Debugger output ✔️ ✔️
LcV Local variables ✔️ ✔️
Prg Program output ✔️ ✔️
Reg Registers ✔️
Src Source file ✔️ ✔️
Stk Stack ✔️ ✔️
Wat Watchpoints ✔️ ✔️

Layouts

[ layout : Main ]

>h
mlqrns
cufk

>w
eeeooooo
wwwooooo
vvvooooo
TTpppddd
  • The order and row of each header (>h) key binding in the configuration determines the corresponding title's position in the header window.
  • Window (>w) size ratios and positions are determinded via "key-binding ASCII art."

Tips

Create a bash script to copy a standard .termfu configuration file to the current directory when starting new projects.

#!/bin/bash

cp $HOME/Dev/configs/.termfu .

Add editor shortcuts to create file.c:123 breakpoint strings and copy them into your clipboard to use in termfu.

  • Vim
function! CreateBreakpoint()
    let l:filename   = expand('%:t')
    let l:linenumber = line('.')
    let l:breakpoint = l:filename . ':' . l:linenumber
    let @+           = l:breakpoint
    echo l:breakpoint
endfunction
nnoremap <leader>b :call CreateBreakpoint()<CR>
  • Neovim
local function create_break ()
    local filename = vim.fn.expand('%:t')
    local linenumber = vim.fn.line('.')
    local breakpoint = filename .. ':' .. linenumber
    vim.fn.setreg('+', breakpoint)
    print(breakpoint)
end

Contributing

See CONTRIBUTING.md.