crash.infra.callback module

exception crash.infra.callback.CallbackCompleted(callback_obj: crash.infra.callback.ObjfileEventCallback)[source]

Bases: RuntimeError

The callback has already been completed and is no longer valid

class crash.infra.callback.ObjfileEventCallback[source]

Bases: object

A generic objfile callback class

When GDB loads an objfile, it can perform callbacks. These callbacks are triggered for every objfile loaded. Once marked complete, the callback is removed so it doesn’t trigger for future objfile loads.

Derived classes need only implement the complete and check_ready methods.

Consumers of this interface must also call connect_callback() to connect the object to the callback infrastructure.

callback(result: Any) → Optional[bool][source]

The callback that derived classes implement for handling the sucessful result of check_ready().

Parameters:result – The result returned from check_ready()
Returns:If None or True, the callback succeeded and will be completed and removed. Otherwise, the callback will stay connected for future completion.
Return type:None or bool
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 than None or False.
Return type:object
complete() → None[source]

Complete and disconnect this callback from the event system.

Raises:CallbackCompleted – This callback has already been completed.
connect_callback() → bool[source]

Connect this callback to the event system.

Raises:CallbackCompleted – This callback has already been completed.