crash.infra.lookup module¶
-
class
crash.infra.lookup.DelayedMinimalSymbol(name: str)[source]¶ Bases:
crash.infra.lookup.DelayedValueA DelayedValue that handles minimal symbols.
Parameters: name – The name of the minimal symbol
-
class
crash.infra.lookup.DelayedMinimalSymval(name: str)[source]¶ Bases:
crash.infra.lookup.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)[source]¶ Bases:
crash.infra.lookup.DelayedValueA DelayedValue that handles symbols.
Parameters: name – The name of the symbol
-
class
crash.infra.lookup.DelayedSymval(name: str)[source]¶ Bases:
crash.infra.lookup.DelayedSymbolA
DelayedSymbolthat returns thegdb.Valueassociated with the symbol.Parameters: name – The name of the symbol.
-
class
crash.infra.lookup.DelayedType(name: str)[source]¶ Bases:
crash.infra.lookup.DelayedValueA DelayedValue for types.
Parameters: name – The name of the type.
-
class
crash.infra.lookup.DelayedValue(name: str, attrname: str = None)[source]¶ Bases:
objectA generic class for making class attributes available that describe to-be-loaded symbols, minimal symbols, and types.
-
class
crash.infra.lookup.MinimalSymbolCallback(name: str, callback: Callable[[Any], Optional[bool]], symbol_file: str = None)[source]¶ Bases:
crash.infra.lookup.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], Optional[bool]], attrname: str = None)[source]¶ Bases:
crash.infra.callback.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) → Union[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
-
check_ready() → Any[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
-
class
crash.infra.lookup.SymbolCallback(name: str, callback: Callable[[Any], Optional[bool]], domain: int = 0)[source]¶ Bases:
crash.infra.lookup.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.
-
check_ready() → Optional[gdb.Symbol][source]¶ Returns the result of looking up the symbol when a new object file is loaded.
Returns: The requested symbol Return type: gdb.Symbol
-
class
crash.infra.lookup.SymvalCallback(name: str, callback: Callable[[Any], Optional[bool]], domain: int = 0)[source]¶ Bases:
crash.infra.lookup.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.-
check_ready() → Optional[gdb.Value][source]¶ After successfully looking up the
gdb.Symbol, returns thegdb.Valueassociated with it.Returns: The value associated with the requested symbol Return type: gdb.Value
-
-
class
crash.infra.lookup.TypeCallback(name: str, callback: Callable[[Any], Optional[bool]], block: gdb.Block = None)[source]¶ Bases:
crash.infra.lookup.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() → Optional[gdb.Type][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)