Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

* 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 [[https://en.wikipedia.org/wiki/Dynamic_debugging_technique][DDT]] (hence the name DMT, /M/ stands for /Meta/, /T/ stands for famous poet, Pasha /Technique/).

** Features

*** Inspecting running processes [75%]
**** DONE List current running processes
#+BEGIN_SRC lisp
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>)
#+END_SRC
**** TODO Get ~top~-like percentage stats
For CPU, memory, IO and network interfaces.

**** DONE Parse ~/proc/<PID>~ data into Lisp objects
#+BEGIN_SRC lisp
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
#+END_SRC

**** DONE Find a process by its name or argument vector (cmdline)
#+BEGIN_SRC lisp
DMT> (first (find-processes "bash --debugger"))
#< 2293234 bash                    5.6M>
#+END_SRC

*** Debugging [16%]

**** DONE Kill a process
A ~kill-process~ method that is implemented using CFFI and C's ~kill (2)~:
#+BEGIN_SRC lisp
DMT> (mapc #'kill-process (find-processes "bash"))
(#< 2293234 bash                    5.6M>
 #< 2293911 bash                    5.6M>
 #< 2293921 bash                    5.6M>)
#+END_SRC

**** TODO Attach ~ptrace~ to a process
**** TODO Read process memory and registers
**** TODO Poke process memory and registers
**** TODO Dump processes
**** TODO 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.


**** TODO Implement shell primitives in Lisp

**** DONE Launch processes
**** DONE Pipe processes
**** DONE Inspect the filesystem (~dired~)

About

Dynamic Meta-debugging Technique

Topics

Resources

Stars

6 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages