Crash Compatibility

drgn provides a compatibility mode emulating the crash utility. Many commands have been ported from crash. These commands can be run directly from the drgn CLI as subcommands of the crash command:

>>> %crash sys
KERNEL: ...

Calling the crash command with no arguments enters an interactive prompt where crash commands can be called directly:

>>> %crash
%crash> sys
KERNEL: ...
%crash>

Most of these commands have an additional --drgn option instructing them to print example drgn code that does the equivalent of the command. This is useful for learning about drgn helpers and APIs. It can also be used to generate a template for doing something more advanced than the command supports. You can copy and paste the output or even write it to a file and edit it before running it:

>>> %crash mount --drgn > mount.py
>>> %sh $EDITOR mount.py
>>> %source mount.py

Commands

help

get help

Synopsis

help [command …]

Description

Print help about one or more commands.

If no commands are given, this lists available commands and prints general help.

Positional Arguments

command

command to get help about, or all for all commands


mount

mounted filesystems

Synopsis

mount [-n pid|task] [--drgn]

Description

List mounted filesystems.

Options

-n pid|task

list mounted filesystems in the namespace of a task, given as either a decimal process ID or a hexadecimal task_struct address. Defaults to the mount namespace of the current context

--drgn

print how to do the equivalent operation using drgn APIs