crash.types.percpu module¶
- exception crash.types.percpu.PerCPUError(var: Value | Symbol)[source]¶
Bases:
TypeErrorThe passed object does not respond to a percpu pointer.
- class crash.types.percpu.PerCPUState[source]¶
Bases:
objectPer-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: Value | Symbol, cpu: int) 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 not
gdb.Symbolorgdb.Value.PerCPUError – var does not fall into any percpu range
ValueError – cpu is less than
0
- get_percpu_vars(var: Value | Symbol, nr_cpus: int = None) Dict[int, 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.Valueused as thedictvalue is the same type as thegdb.Valueorgdb.Symbolpassed as var.- Return type:
dict`(:obj:`int,gdb.Value)- Raises:
.InvalidArgumentError – var is not
gdb.Symbolorgdb.Value.PerCPUError – var does not fall into any percpu range
ValueError – 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: Value | 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: Value | Symbol, cpu: int) 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 not
gdb.Symbolorgdb.Value.PerCPUError – var does not fall into any percpu range
ValueError – cpu is less than
0
- crash.types.percpu.get_percpu_vars(var: Value | Symbol, nr_cpus: int = None) Dict[int, 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.Valueused as thedictvalue is the same type as thegdb.Valueorgdb.Symbolpassed as var.- Return type:
dict`(:obj:`int,gdb.Value)- Raises:
.InvalidArgumentError – var is not
gdb.Symbolorgdb.Value.PerCPUError – var does not fall into any percpu range
ValueError – nr_cpus is <=
0