crash.types.percpu module¶
-
exception
crash.types.percpu.
PerCPUError
(var: Union[gdb.Value, gdb.Symbol])[source]¶ Bases:
TypeError
The passed object does not respond to a percpu pointer.
-
class
crash.types.percpu.
PerCPUState
[source]¶ Bases:
object
Per-cpus come in a few forms: - “Array” of objects - “Array” of pointers to objects - Pointers to either of those
If we want to get the typing right, we need to recognize each one and figure out what type to pass back. We do want to dereference pointer to a percpu but we don’t want to dereference a percpu pointer.
-
get_percpu_var
(var: Union[gdb.Value, gdb.Symbol], cpu: int) → gdb.Value[source]¶ Retrieve a per-cpu variable for one or all CPUs
Parameters: - var – The symbol or value to use to resolve the percpu location
- cpu – The cpu for which to return the per-cpu value.
Returns: The value corresponding to the specified CPU. The value is of the same type passed via var.
Return type: Raises: InvalidArgumentError
– var is notgdb.Symbol
orgdb.Value
PerCPUError
– var does not fall into any percpu rangeValueError
– cpu is less than0
-
get_percpu_vars
(var: Union[gdb.Value, gdb.Symbol], nr_cpus: int = None) → Dict[int, gdb.Value][source]¶ Retrieve a per-cpu variable for all CPUs
Parameters: - var – The symbol or value to use to resolve the percpu location
- nr_cpus (optional) – The number of CPUs for which to return results
None
(or unspecified) will use the highest possible CPU count.
Returns: The values corresponding to every CPU in a dictionary indexed by CPU number. The type of the
gdb.Value
used as thedict
value is the same type as thegdb.Value
orgdb.Symbol
passed as var.Return type: dict`(:obj:`int
,gdb.Value
)Raises: InvalidArgumentError
– var is notgdb.Symbol
orgdb.Value
PerCPUError
– var does not fall into any percpu rangeValueError
– nr_cpus is <=0
-
is_module_percpu_var
(addr: int) → bool[source]¶ Returns whether the provided value or symbol falls within any of the percpu ranges for modules
Parameters: addr – The address to query Returns: Whether this address belongs to a module range Return type: bool
-
is_percpu_var
(var: Union[gdb.Value, gdb.Symbol]) → bool[source]¶ Returns whether the provided value or symbol falls within any of the percpu ranges
Parameters: var – The symbol or value to query Returns: Whether the value belongs to any percpu range Return type: bool
-
-
crash.types.percpu.
get_percpu_var
(var: Union[gdb.Value, gdb.Symbol], cpu: int) → gdb.Value[source]¶ Retrieve a per-cpu variable for a single CPU
Parameters: - var – The symbol or value to use to resolve the percpu location
- cpu – The cpu for which to return the per-cpu value.
Returns: The value corresponding to the specified CPU. The value is of the same type passed via var.
Return type: Raises: InvalidArgumentError
– var is notgdb.Symbol
orgdb.Value
PerCPUError
– var does not fall into any percpu rangeValueError
– cpu is less than0
-
crash.types.percpu.
get_percpu_vars
(var: Union[gdb.Value, gdb.Symbol], nr_cpus: int = None) → Dict[int, gdb.Value][source]¶ Retrieve a per-cpu variable for all CPUs
Parameters: - var – The symbol or value to use to resolve the percpu location.
- nr_cpus (optional) – The number of CPUs for which to return results.
None
(or unspecified) will use the highest possible CPU count.
Returns: The values corresponding to every CPU in a dictionary indexed by CPU number. The type of the
gdb.Value
used as thedict
value is the same type as thegdb.Value
orgdb.Symbol
passed as var.Return type: dict`(:obj:`int
,gdb.Value
)Raises: InvalidArgumentError
– var is notgdb.Symbol
orgdb.Value
PerCPUError
– var does not fall into any percpu rangeValueError
– nr_cpus is <=0