A minimal toy implementation of strace(1)
ministrace is a small strace implementation by Nelson Elhage (@nelhage).
ministrace is a minimal implementation of strace originally about 70 lines of C. It isn't nearly as functional as the real thing, but you can use it to learn most of what you need to know about the core interfaces it uses.
ministrace was written for a blog post, which explains in some detail how it works.
ministrace [-n |-s ]
Basic ministrace usage just takes a command line:
This will run the program provided with the given arguments, and print out a sequence of all the system calls which made by the program.
You can also specify a specific system call, using
ministrace -n ministrace -s
This will print out a sequence of system calls which are made, and block (waiting for an enter on ministrace's terminal) whenever the program is about to execute the specified system call.