7 Using the drgn
Library With Python
Debug live kernels and vmcore
crash dumps in a Python shell, and
Python scripts, by importing the drgn
library.
Before you can start using drgn with Python scripts, ensure that Python is correctly installed on the system. For more information, see Oracle Linux 8: Installing and Managing Python.
If the script runs on Python 3.6,
also install the drgn
package. For more information, see Installing drgn.
Note:
To import the drgn
library in scripts that run on newer versions
of Python 3, enable the ol8_addons
repository, then specify the version in the package name.
For example, you could install the python3.12-drgn
package to
import the drgn
library in a script that runs on Python
3.12:
sudo dnf config-manager --enable ol8_addons
sudo dnf install python3.12-drgn
If no matching packages are available in the ol8_addons
yum
repository, then that Python version might no longer be supported. For more information, see Oracle Linux: Product Life Cycle Information.
You can optionally run the drgn
command with Python 3.12 as the
interpreter by running the following command:
python3.12 -m drgn
Unlike the crash
utility, Drgn wasn't originally designed to be a standalone
kernel debugging tool. Drgn is a Python programming library that exposes debugging information
for scripting and review purposes.
The Python script loaded an array of kernel debugging information and crash data.