[Lldb-commits] [PATCH] D143213: [lldb/Plugins] Introduce Multiplexer & ScriptedMultiplexer

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 2 13:27:40 PST 2023


mib created this revision.
mib added reviewers: JDevlieghere, jingham, labath.
mib added a project: LLDB.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

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 at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143213

Files:
  lldb/bindings/python/CMakeLists.txt
  lldb/bindings/python/python-swigsafecast.swig
  lldb/bindings/python/python-wrapper.swig
  lldb/examples/python/scripted_process/scripted_multiplexer.py
  lldb/examples/python/scripted_process/scripted_process.py
  lldb/include/lldb/API/SBEvent.h
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/include/lldb/Interpreter/ScriptedMultiplexer.h
  lldb/include/lldb/Interpreter/ScriptedMultiplexerInterface.h
  lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
  lldb/include/lldb/Target/Multiplexer.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Core/Debugger.cpp
  lldb/source/Interpreter/CMakeLists.txt
  lldb/source/Interpreter/ScriptInterpreter.cpp
  lldb/source/Interpreter/ScriptedMultiplexer.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
  lldb/source/Plugins/Process/scripted/ScriptedProcess.h
  lldb/source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
  lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedMultiplexerPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedMultiplexerPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Multiplexer.cpp
  lldb/test/API/functionalities/scripted_multiplexer/Makefile
  lldb/test/API/functionalities/scripted_multiplexer/TestScriptedMultiplexer.py
  lldb/test/API/functionalities/scripted_multiplexer/main.cpp
  lldb/test/API/functionalities/scripted_multiplexer/multiplexed_scripted_process.py
  lldb/test/API/functionalities/scripted_platform/Makefile
  lldb/test/API/functionalities/scripted_platform/TestScriptedPlatform.py
  lldb/test/API/functionalities/scripted_platform/main.cpp
  lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143213.494424.patch
Type: text/x-patch
Size: 59037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230202/7ba250cc/attachment-0001.bin>


More information about the lldb-commits mailing list