Skip to content
Tech News
← Back to articles

Strace-ui, Bonsai_term, and the TUI renaissance

read original more articles
Why This Matters

The introduction of strace-ui marks a significant advancement in debugging tools by transforming the traditionally complex and inscrutable strace output into an interactive, user-friendly interface. This enhancement simplifies process tracing, filtering, and analysis, making it more accessible for developers and system administrators, ultimately improving debugging efficiency and system reliability in the tech industry.

Key Takeaways

We’ve always found strace useful but somewhat hard to work with. Its output is often inscrutable, it’s hard to follow subprocesses or threads, and if you want to filter syscalls you have to rerun the trace with a flag for each one. What you want in debugging is a tool for exploring, refining, etc., but strace can make this difficult.

Enter strace-ui, which turns strace into an interactive terminal UI:

strace-ui assigns short IDs to PIDs to make them easier to scan, formats structs, and renders buffers as hexdumps instead of strings. It has some other nice features that you can’t see in the screenshot:

Interactive filtering. Tracing an async OCaml process? Did you forget to pass -e '!futex,timerfd_settime,epoll_wait' ? Don’t worry: press h to hide any syscall you don’t care about.

? Don’t worry: press to hide any syscall you don’t care about. Trace a particular file-descriptor. Press > or < to jump to the next/previous syscall that referenced the same file descriptor, or press F to change your filter to only include syscalls that touch a given FD. (it’s slightly smarter than just numeric FD filtering: strace-ui tries to track FD re-use and follow across forks, but it doesn’t do a great job of that if you attach to a process that’s already opened FDs.)

or to jump to the next/previous syscall that referenced the same file descriptor, or press to change your filter to only include syscalls that touch a given FD. (it’s slightly smarter than just numeric FD filtering: strace-ui tries to track FD re-use and follow across forks, but it doesn’t do a great job of that if you attach to a process that’s already opened FDs.) What even is rt_sigprocmask ? Press m to open the man page and find out.

? Press to open the man page and find out. Subprocesses or threads are assigned short numeric labels, instead of showing you the raw pid, making it easier to follow a complex strace -f calls. (You can also filter by PID or exclude PIDs.)

calls. (You can also filter by PID or exclude PIDs.) DNS resolution: strace’s --decode-fds=all will print file descriptors as 14<TCP:[55.55.555.555:12345->11.11.11.11:56789]>, which is great. strace-ui goes one step further and prints 14<TCP:[a-real-hostname:12345->another-hostname:56789]> , which makes it easier to see at a glance exactly what your process is doing.

Ian Henry, a dev here, made strace-ui to scratch his own itch. In 2017, he’d gone looking for such a tool but never found it. Having had experience building interactive terminal UIs (including in OCaml, using lambda_term), he knew how difficult and unpleasant it could be. The idea percolated over the years, never feeling worth it, until recently when a few forces converged to make terminal UI development actually kind of delightful.

Bonsai, a powerful framework for reactive UIs

... continue reading