crash.types.classdev module

The crash.types.classdev module offers helpers to work with class devices.

class crash.types.classdev.ClassdevState[source]

Bases: object

classmethod class_is_private() → bool[source]

Returns whether the class device uses struct device_private

Meant to be used only be crash.types.classdev.

classmethod setup_iterator_type(gdbtype: gdb.Type) → None[source]

Detect whether to iterate the class list using struct device or struct device_private.

Linux v5.1-rc1 moved knode_class from struct device to struct device_private. We need to detect it here to ensure list iteration works properly.

Meant to be used as a TypeCallback.

Parameters:gdbtype – The struct device type.
crash.types.classdev.for_each_class_device(class_struct: gdb.Value, subtype: gdb.Value = None) → Iterable[gdb.Value][source]

Iterate over the list of class devices

Parameters:
  • class_struct – The class of devices to iterate
  • subtype – A struct device_type * to use to filter the results. The value must be of type struct device_type * and will be used to compare against the type field of each struct device.
Yields:

gdb.Value – A device on the class’s device list. The value is of type struct device.