A minimal toy implementation of strace(1)
Clone or download
nelhage Merge pull request #4 from hpvb/parameter-fix
Fix AMD64 get_syscall_arg()
Latest commit a061d74 Jul 14, 2014
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Extract more information about syscalls. Aug 14, 2010
Makefile Add amd64 support. Aug 29, 2010
README.md Some README tweaks. Jul 13, 2013
gen_tables.py Add amd64 support. Aug 29, 2010
ministrace.c Fix AMD64 get_syscall_arg() Jul 14, 2014
syscalls.h Correctly compute argument types, and pretty-print string arguments. Aug 14, 2010

README.md

ministrace

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.

Usage

ministrace [-n <system call name>|-s <system call int>] <program> <program args>

Basic ministrace usage just takes a command line:

ministrace <program> <program args>

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 -n sys_call_name or -s sys_call_number:

ministrace -n <system call name> <program> <program args>
ministrace -s <system call int> <program> <program args>

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.