crash.infra.lookup module¶
- class crash.infra.lookup.DelayedMinimalSymbol(name: str, wait_for_target: bool = True)[source]¶
Bases:
DelayedValueA DelayedValue that handles minimal symbols.
- Parameters:
name – The name of the minimal symbol
- class crash.infra.lookup.DelayedMinimalSymval(name: str, wait_for_target: bool = True)[source]¶
Bases:
DelayedMinimalSymbolA DelayedMinimalSymbol that returns the address of the minimal symbol as an
int.- Parameters:
name – The name of the minimal symbol.
- class crash.infra.lookup.DelayedSymbol(name: str, wait_for_target: bool = True)[source]¶
Bases:
DelayedValueA DelayedValue that handles symbols.
- Parameters:
name – The name of the symbol
- class crash.infra.lookup.DelayedSymval(name: str, wait_for_target: bool = True)[source]¶
Bases:
DelayedSymbolA
DelayedSymbolthat returns thegdb.Valueassociated with the symbol.- Parameters:
name – The name of the symbol.
- class crash.infra.lookup.DelayedType(name: str, wait_for_target: bool = True, block: Block = None)[source]¶
Bases:
DelayedValueA DelayedValue for types.
- Parameters:
name – The name of the type.
- class crash.infra.lookup.DelayedValue(name: str, wait_for_target: bool = True, **kwargs: Any)[source]¶
Bases:
objectA generic class for making class attributes available that describe to-be-loaded symbols, minimal symbols, and types.
- attach_callback(cbcls: Type[NamedCallback], **kwargs: Any) None[source]¶
- class crash.infra.lookup.MinimalSymbolCallback(name: str, callback: Callable[[Any], bool | None], wait_for_target: bool = True, symbol_file: str = None)[source]¶
Bases:
NamedCallbackA callback that executes when the named minimal symbol is discovered in the objfile and returns the
gdb.MinSymbol.The callback must accept a
gdb.MinSymboland returnboolorNone.- Parameters:
name – The name of the minimal symbol to discover
callback – The callback to execute when the minimal symbol is discovered
symbol_file (optional) – Name of the symbol file to use
- class crash.infra.lookup.NamedCallback(name: str, callback: Callable[[Any], bool | None], wait_for_target: bool = True, **kwargs: Any)[source]¶
Bases:
ObjfileEventCallbackA base class for Callbacks with names
This cannot be used directly since it does not provide a method for
ObjfileEventCallback.callback().- Parameters:
name – The name of the symbol or type to be resolved.
callback – A function to call with the result of the derived class’s
ObjfileEventCallback.check_ready()method.attrname (optional) – A name safe for use as an attribute name. If unspecified, defaults to the same string as name.
- name¶
The name of the symbol or type being resolved.
- Type:
str
- attrname¶
The name of symbol or type being resolved translated for use as an attribute name.
- Type:
str
- callback(result: Any) None | bool[source]¶
The callback for handling the sucessful result of
check_ready().It indirectly calls the callback specified in the constructor.
- Parameters:
result – The result returned from
check_ready()- Returns:
If
NoneorTrue, the callback succeeded and will be completed and removed. Otherwise, the callback will stay connected for future completion.- Return type:
Noneorbool
- class crash.infra.lookup.SymbolCallback(name: str, callback: Callable[[Any], bool | None], wait_for_target: bool = True, domain: int = 0)[source]¶
Bases:
NamedCallbackA callback that executes when the named symbol is discovered in the objfile and returns the
gdb.Symbol.The callback must accept a
gdb.Symboland returnboolorNone.- Parameters:
name – The name of the symbol to discover
callback – The callback to execute when the symbol is discovered
domain (optional) – The domain to search for the symbol. The value is assumed to be one of the value associated with
gdb.Symbolconstant, i.e. SYMBOL_*_DOMAIN.
- class crash.infra.lookup.SymvalCallback(name: str, callback: Callable[[Any], bool | None], wait_for_target: bool = True, domain: int = 0)[source]¶
Bases:
SymbolCallbackA callback that executes when the named symbol is discovered in the objfile and returns the
gdb.Valueassociated with thegdb.Symbol.The callback must accept a
gdb.Valueand returnboolorNone.See
SymbolCallbackfor arguments.
- class crash.infra.lookup.TypeCallback(name: str, callback: Callable[[Any], bool | None], wait_for_target: bool = True, block: Block = None, **kwargs: Any)[source]¶
Bases:
NamedCallbackA callback that executes when the named type is discovered in the objfile and returns the
gdb.Typeassociated with it.The callback must accept a
gdb.Typeand returnboolorNone.- Parameters:
name – The name of the type to discover
callback – The callback to execute when the type is discovered
block (optional) – The
gdb.Blockto search for the symbol
- check_ready() Type | None[source]¶
The method that derived classes implement for detecting when the conditions required to call the callback have been met.
- Returns:
This method can return an arbitrary object. It will be passed untouched to
callback()if the result is anything other thanNoneorFalse.- Return type:
object
- static resolve_type(name: str) Tuple[str, str, bool][source]¶
This function takes a C type name and translates it into a 3-tuple that contains the basic type name, the type name translated to a form suitable for an attribute name, and whether the type corresponds to a pointer.
The basic type name has all leading and trailing whitespace stripped, and any
*removed.The attribute type name takes that base, removes the leading
structfor structure types, removes any leading or trailing whitespace, replaces internal spaces with underscores, and appends a_typeor_p_typesuffix, depending on whether the type is a pointer type.Some examples:
struct foo→foo_typestruct foo *→foo_p_typeunsigned long→unsigned_long_type
- Notes:
- Multiple levels of pointers are not handled properly. In
practice this means that
struct foo *andstruct foo **can’t be used simultaneously. This is typically not a problem.
- Unions are not handled as a special case as structs are. A
union type would use an attribute name of
union_foo_type.
- Returns:
A 3-tuple consisting of the basic type name, the name formatted for use as an attribute name, and whether the type is a pointer type.
- Return type:
(
str,str,bool)