Extending Target Stop-Hooks#
Stop hooks fire whenever the process stops just before control is returned to the
user. Stop hooks can either be a set of lldb command-line commands, or can
be implemented by a suitably defined Python class. The Python-based stop-hooks
can also be passed as a set of -key -value pairs when they are added, and those
will get packaged up into a SBStructuredData
Dictionary and passed to the
constructor of the Python object managing the stop hook. This allows for
parameterization of the stop hooks.
To add a Python-based stop hook, first define a class with the following methods:
Name |
Arguments |
Description |
---|---|---|
|
|
This is the constructor for the new stop-hook. |
|
|
This is the called when the target stops. |
To use this class in lldb, run the command:
(lldb) command script import MyModule.py
(lldb) target stop-hook add -P MyModule.MyStopHook -k first -v 1 -k second -v 2
where MyModule.py
is the file containing the class definition MyStopHook
.