drgn¶
drgn (pronounced “dragon”) is a debugger with an emphasis on programmability. drgn exposes the types and variables in a program for easy, expressive scripting in Python. For example, you can debug the Linux kernel:
>>> from drgn.helpers.linux import list_for_each_entry
>>> for mod in list_for_each_entry('struct module',
... prog['modules'].address_of_(),
... 'list'):
... if mod.refcnt.counter > 10:
... print(mod.name)
...
(char [56])"snd"
(char [56])"evdev"
(char [56])"i915"
Although other debuggers like GDB have scripting support, drgn aims to make scripting as natural as possible so that debugging feels like coding. This makes it well-suited for introspecting the complex, inter-connected state in large programs.
Additionally, drgn is designed as a library that can be used to build debugging and introspection tools; see the official tools.
drgn was developed at Meta for debugging the Linux kernel (as an alternative to the crash utility), but it can also debug userspace programs written in C. C++ support is in progress.
In addition to the main Python API, an experimental C library, libdrgn
, is
also available.
See the Installation instructions. Then, start with the User Guide.
Getting Help¶
The GitHub issue tracker is the preferred method to report issues.
There is also a Linux Kernel Debuggers Matrix room.
License¶
Copyright (c) Meta Platforms, Inc. and affiliates.
drgn is licensed under the LGPLv2.1 or later.
Acknowledgements¶
Table of Contents¶
Using drgn
Tutorials
Reference
- API Reference
- Helpers
ValidationError
- Common
- Experimental
- Linux Kernel
- Bit Operations
- Block Layer
- Boot
- BPF
- Cgroup
- CPU Masks
- Devices
- Virtual Filesystem Layer
- IDR
- Kallsyms
- Kconfig
- Kernfs
- Kernel Threads
- Linked Lists
- Nulls Lists
- Lockless Lists
- Maple Trees
- Memory Management
- Modules
- Networking
- NUMA Node Masks
- Per-CPU
- Process IDS
- Priority-Sorted Lists
- Log Buffer
- Radix Trees
- Red-Black Trees
- CPU Scheduler
- Slab Allocator
- Stack Depot
- Traffic Control (TC)
- TCP
- Users
- Wait Queues
- XArrays
- Man Page
- Support Matrix
- Release Highlights
- 0.0.31 (Released April 16th, 2025)
- Module API
- Options for Finding Debugging Symbols
- Stricter Debugging Symbol File Matching
- Debuginfod Integration
- Custom Debugging Information Finders
- Plugins
- Running Code Snippets on the Command Line
- Kernel Stack Unwinding Without Debugging Symbols
- Linux 6.14 and 6.15 Support
- Last Release With Python 3.6 & 3.7 Support
- 0.0.30 (Released December 18th, 2024)
- 0.0.28 & 0.0.29 (Released October 7th & 8th, 2024)
- 0.0.27 (Released July 1st, 2024)
- 0.0.26 (Released March 11th, 2024)
- 0.0.25 (Released December 1st, 2023)
- 0.0.24 (Released September 8th, 2023)
- 0.0.23 (Released June 28th, 2023)
- 0.0.22 (Released January 5th, 2023)
- 0.0.31 (Released April 16th, 2025)