crash.types.list module

exception crash.types.list.CorruptListError[source]

Bases: crash.types.list.ListError

exception crash.types.list.ListCycleError[source]

Bases: crash.types.list.CorruptListError

exception crash.types.list.ListError[source]

Bases: Exception

crash.types.list.list_empty(list_head: gdb.Value) → bool[source]

Test whether a list is empty

Parameters:list_head – The list to test. The value must be of type struct list_head or struct list_head *.
Returns:Whether the list is empty.
Return type:bool
Raises:gdb.NotAvailableError – The target value is not available.
crash.types.list.list_for_each(list_head: gdb.Value, include_head: bool = False, reverse: bool = False, print_broken_links: bool = True, exact_cycles: bool = False) → Iterator[gdb.Value][source]

Iterate over a list and yield each node

Parameters:
  • list_head – The list to iterate. The value must be of type struct list_head or struct list_head *.
  • include_head (optional) – Include the head of the list in iteration - useful for lists with no anchors
  • reverse (optional) – Iterate the list in reverse order (follow the prev links)
  • print_broken_links (optional) – Print warnings about broken links
  • exact_cycles (optional) – Detect and raise an exception if a cycle is detected in the list
Yields:

gdb.Value – The next node in the list. The value is of type struct list_head.

Raises:
  • CorruptListError – the list is corrupted
  • ListCycleError – the list contains cycles
  • BufferError – portions of the list cannot be read
  • gdb.NotAvailableError – The target value is not available.
crash.types.list.list_for_each_entry(list_head: gdb.Value, gdbtype: gdb.Type, member: str, include_head: bool = False, reverse: bool = False, print_broken_links: bool = True, exact_cycles: bool = False) → Iterator[gdb.Value][source]

Iterate over a list and yield each node’s containing object

Parameters:
  • list_head – The list to iterate. The value must be of type struct list_head or struct list_head *.
  • gdbtype – The type of the containing object
  • member – The name of the member in the containing object that corresponds to the list_head
  • include_head (optional) – Include the head of the list in iteration - useful for lists with no anchors
  • reverse (optional) – Iterate the list in reverse order (follow the prev links)
  • print_broken_links (optional) – Print warnings about broken links
  • exact_cycles (optional) – Detect and raise an exception if a cycle is detected in the list
Yields:

gdb.Value – The next node in the list. The value is of the specified type.

Raises:
  • CorruptListError – the list is corrupted
  • ListCycleError – the list contains cycles
  • BufferError – portions of the list cannot be read
  • gdb.NotAvailableError – The target value is not available.