ScriptedHook#

class lldb.plugins.scripted_hook.ScriptedHook(target: SBTarget, args: SBStructuredData)#

The base class for a scripted target hook.

A single ScriptedHook subclass backs both target hook add -P and target stop-hook add -P. handle_stop is required so a hook can always be attached as a stop-hook; handle_module_loaded and handle_module_unloaded are optional and only called for hooks registered via target hook add -P.

Methods Summary

handle_module_loaded(stream)

Called whenever a module is loaded into the target.

handle_module_unloaded(stream)

Called whenever a module is unloaded from the target.

handle_stop(exe_ctx, stream)

Called whenever the process stops, before control is returned to the user.

Methods Documentation

handle_module_loaded(stream: SBStream) None#

Called whenever a module is loaded into the target.

Parameters:

stream (lldb.SBStream) – The stream to which the hook can write output that will be reported to the user.

handle_module_unloaded(stream: SBStream) None#

Called whenever a module is unloaded from the target.

Parameters:

stream (lldb.SBStream) – The stream to which the hook can write output that will be reported to the user.

abstract handle_stop(exe_ctx: SBExecutionContext, stream: SBStream) bool#

Called whenever the process stops, before control is returned to the user.

Parameters:
  • exe_ctx (lldb.SBExecutionContext) – The execution context at the point of the stop.

  • stream (lldb.SBStream) – The stream to which the hook can write output that will be reported to the user.

Returns:

True if the process should stop and control should be returned to the user, False if the process should keep running.

Return type:

bool