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
set¶
set current context or configuration
Synopsis¶
set [pid | task | -p | -c CPU | option [value]] [--drgn]
Description¶
Set/show the default context used by commands that target a task, or set/show configuration.
If no options are given, then the current context is displayed.
If given a configuration option name and a value, then the option is set to that value. If given a configuration option name only, then the current value is shown. The following options and values are supported:
scroll on | off
: enable (the default) or disable scrolling of long output.scroll less | more
: set the pager program. The default isless
.
Positional Arguments¶
- pid¶
set the current context to the task with the given decimal process ID
- task¶
set the current context to the task with the hexadecimal
task_struct
address
- option¶
option to get or set
- value¶
value to set option to
Options¶
- -c CPU¶
set the current context to the active task on the given CPU
- -p¶
set the current context to the task that crashed (for core dumps) or the drgn process itself (for live kernels)
- --drgn¶
print how to do the equivalent operation using drgn APIs
sys¶
system information
Synopsis¶
sys [--drgn] [config]
Positional Arguments¶
- config¶
print kernel configuration (requires
CONFIG_IKCONFIG
)
Options¶
- --drgn¶
print how to do the equivalent operation using drgn APIs