[all-commits] [llvm/llvm-project] a3d4f7: [lldb/Plugins] Fix method dispatch bug when using ...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Mon Feb 6 16:03:28 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3d4f739eea357c702754246442a2568f2bace81
      https://github.com/llvm/llvm-project/commit/a3d4f739eea357c702754246442a2568f2bace81
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-02-06 (Mon, 06 Feb 2023)

  Changed paths:
    M lldb/include/lldb/Interpreter/ScriptInterpreter.h
    M lldb/include/lldb/Interpreter/ScriptedInterface.h
    M lldb/source/Interpreter/ScriptInterpreter.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.h
    M lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
    M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
    M lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py

  Log Message:
  -----------
  [lldb/Plugins] Fix method dispatch bug when using multiple scripted processes

This patch should address a bug when a user have multiple scripted
processes in the same debugging session.

In order for the scripted process plugin to be able to call into the
scripted object instance methods to fetch the necessary data to
reconstruct its state, the scripted process plugin calls into a
scripted process interface, that has a reference to the created script
object instance.

However, prior to this patch, we only had a single instance of the
scripted process interface, living the script interpreter. So every time
a new scripted process plugin was created, it would overwrite the script
object instance that was held by the single scripted process interface
in the script interpreter.

That would cause all the method calls made to the scripted process
interface to be dispatched by the last instanciated script object
instance, which is wrong.

In order to prevent that, this patch moves the scripted process
interface reference to be help by the scripted process plugin itself.

rdar://104882562

Differential Revision: https://reviews.llvm.org/D143308

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




More information about the All-commits mailing list