$linuxjunkies
>

debugfs

also: debugfs filesystem, kernel debugfs

A filesystem-based debugging interface that exposes kernel internal data structures and allows runtime inspection and modification of kernel state through a mounted virtual filesystem.

debugfs is a special kernel debugging filesystem that provides a convenient way to access kernel debugging information without writing specialized tools. It's typically mounted at /sys/kernel/debug and allows users and developers to inspect kernel state dynamically.

The filesystem is hierarchically organized with files and directories representing different kernel subsystems. Reading from these files returns kernel data, and writing to some files can trigger kernel actions or change settings. For example, /sys/kernel/debug/tracing contains the kernel's ftrace (function tracer) configuration, allowing real-time kernel function tracing.

Example usage: cat /sys/kernel/debug/gpio shows GPIO (General Purpose Input/Output) pin states, or echo 1 > /sys/kernel/debug/kprobes/enabled enables kernel probes for dynamic instrumentation. Access typically requires root privileges for security reasons.

Related terms