crash.subsystem.storage.decoders module¶
- class crash.subsystem.storage.decoders.BadBHDecoder(bh: Value)[source]¶
Bases:
DecoderPlaceholder decoder for bad buffer_head pointers
Rather than raise a
gdb.NotAvailableErrorduring decoding, we use aBadBHDecoderdecoder to annotate where in the chain there was an invalid buffer_head.- Parameters:
bh – The
struct buffer_headto be decoded. The value must be of typestruct buffer_head.
- class crash.subsystem.storage.decoders.BadBioDecoder(bio: Value)[source]¶
Bases:
DecoderPlaceholder decoder for bad bio pointers
Rather than raise a
NotAvailableErrorduring decoding, we use aBadBioDecoderdecoder to annotate where in the chain there was an invalid bio.- Parameters:
bio – The bio to decode. The value must be of type
struct bio.
- class crash.subsystem.storage.decoders.Decoder(value: Value = None)[source]¶
Bases:
objectDecoder objects are used to unwind the storage stack
They are relatively lightweight at runtime, meaning that the object is initialized but not decoded until it’s needed. The string will be formatted each time, but each
Decoder’sinterpret()method will be called once.- interpret() None[source]¶
Interpret the
DecoderobjectRather than populate all the fields when they may not be used, we delay interpreting the object until the fields are needed.
This method will examine the object passed to the derived class’s constructor and produce the attributes required for each object.
- class crash.subsystem.storage.decoders.GenericBHDecoder(bh: Value)[source]¶
Bases:
DecoderDecodes a bio that references a
struct buffer_headThis method decodes a generic
struct buffer_head, when no implementation-specific decoder is available- Parameters:
bh – The
struct buffer_headto be decoded. The value must be of typestruct buffer_head.
- bh¶
The
struct buffer headthat was referenced from the bio. The value is of typestruct buffer_head.- Type:
- interpret() None[source]¶
Interpret the
DecoderobjectRather than populate all the fields when they may not be used, we delay interpreting the object until the fields are needed.
This method will examine the object passed to the derived class’s constructor and produce the attributes required for each object.
- class crash.subsystem.storage.decoders.GenericBioDecoder(bio: Value)[source]¶
Bases:
DecoderPlaceholder decoder for when we have a valid bio but nothing to decode it
- Parameters:
bio – The bio to decode. The value must be of type
struct bio.
- crash.subsystem.storage.decoders.decode_bh(bh: Value) Decoder[source]¶
Decodes a single buffer_head, if possible
This method will return a
Decoderobject describing a singlestruct buffer_headafter decoding it using a registered decoder, if available.If no decoder is registered, a generic decoder will be used.
If an invalid object is encountered, a handler decoder will be used.
- Parameters:
bh – The buffer_head to decode. The value must be of type
struct buffer_head.- Returns:
The decoder appropriate for this buffer_head type
- Return type:
- crash.subsystem.storage.decoders.decode_bio(bio: Value) Decoder[source]¶
Decodes a single bio, if possible
This method will return a
Decoderobject describing a single bio after decoding it using a registered decoder, if available.If no decoder is registered, a generic decoder will be used.
If an invalid object is encountered, a handler decoder will be used.
- Parameters:
bio – The bio to decode. The value must be of type
struct bio.- Returns:
The decoder appropriate for this bio type.
- Return type:
- crash.subsystem.storage.decoders.for_each_bio_in_stack(bio: Value) Iterable[Decoder][source]¶
Iterates and decodes each bio involved in a stacked storage environment
This method will yield a Decoder object describing each level in the storage stack, starting with the provided bio, as processed by each level’s decoder. The stack will be interrupted if an encountered object doesn’t have a decoder specified.
- crash.subsystem.storage.decoders.register_decoder(endio: int | str | List[str] | Value | Symbol, decoder: Type[Decoder]) None[source]¶
Registers a bio/buffer_head decoder with the storage subsystem.
A decoder is a class that accepts a bio, buffer_head, or other object, potentially interprets the private members of the object, and returns a
Decoderobject that describes it.The only mandatory part of a
Decoderis the__str__()method to format the description.If the bio is part of a stack, the
__next__()method will contain the nextDecoderobject in the stack. It does not necessarily need to be a bio. TheDecoderdoes not need to be registered unless it will be a top-level decoder.Other attributes can be added as-needed to allow informed callers to obtain direct information.
- Parameters:
endio –
The function(s) used as endio callback(s).
The
strorlistofstrarguments are used to register a callback such that theDecoderis registered when the symbol is available.The
gdb.Symbol,gdb.Value, andintversions are to be used once the symbol is available for resolution.If in doubt, use the names instead of the
gdb.Symbolobjects.decoder – The decoder class used to handle this object.