This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Plugins] Introduce Multiplexer & ScriptedMultiplexer
Needs ReviewPublic

Authored by mib on Feb 2 2023, 1:27 PM.

Details

Summary

This patch introduces a new core component to LLDB: Multiplexer.

The goal of a multiplexer is to stand between the debugger and a list of
processes to intercept events and re-dispatch them to the right processes.

This patch also introduces a special kind of multiplexer: ScriptedMultiplexer.
As the name suggests, it lets the user have a custom implementation of
the multiplexer in a script file that can be imported into lldb.

The ScriptedMultiplexer implements a FilterEvent(SBEvent&) method that
will allow the user to iterate over the list of multiplexed processes
and decide to which one the event should be sent to.

The multiplexer gets instanciated when a ScriptedProcess implements the
get_scripted_multiplexer method that returns a well-formed dictionary.
The multiplexer instance gets stored in the debugger object.

For the process to be handled by the multiplexer, they all need to
provide the same multiplexer name in the dictionary.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail