Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.03 KB

README.org

File metadata and controls

62 lines (49 loc) · 2.03 KB

The DMT Debugging Shell

This is a project to implement an interactive Linux shell with debugging and statistical features in ANSI Common Lisp.

Inspired by the Lisp REPL and Incompatible Timesharing System’s DDT (hence the name DMT, M stands for Meta, T stands for famous poet, Pasha Technique).

Features

Inspecting running processes [75%]

List current running processes

DMT> (serapeum:take 5 (list-processes :sort-by 'memory))
(#< 1168427 mako                 1678.6M>
 #< 1177795 firefox              1198.7M>
 #< 1290815 telegram-deskto       971.7M>
 #< 1428289 Isolated Web Co       493.0M>
 #< 1168356 emacs                 450.5M>)

Get top-like percentage stats

For CPU, memory, IO and network interfaces.

Parse /proc/<PID> data into Lisp objects

DMT> (with-slots (stat stat-memory pid) (make-process 1)
       (values stat stat-memory pid))
#S(PROC-STAT (systemd))
#S(PROC-STAT-MEMORY :RESIDENT  11.9M :SHARED   8.8M)
1

Find a process by its name or argument vector (cmdline)

DMT> (first (find-processes "bash --debugger"))
#< 2293234 bash                    5.6M>

Debugging [16%]

Kill a process

A kill-process method that is implemented using CFFI and C’s kill (2):

DMT> (mapc #'kill-process (find-processes "bash"))
(#< 2293234 bash                    5.6M>
 #< 2293911 bash                    5.6M>
 #< 2293921 bash                    5.6M>)

Attach ptrace to a process

Read process memory and registers

Poke process memory and registers

Dump processes

Control execution flow of a process

Shell [75%]

We already have a wonderful REPL, so the plan is to provide a good interface for basic UNIX shell operations.

Implement shell primitives in Lisp

Launch processes

Pipe processes

Inspect the filesystem (dired)