[all-commits] [llvm/llvm-project] 4858fe: [lldb/Plugins] Add ScriptedProcess::GetThreadsInfo...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Mon Jan 24 11:26:24 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4858fe04a1571e78ff97b778c0fb6a46855c3d6a
      https://github.com/llvm/llvm-project/commit/4858fe04a1571e78ff97b778c0fb6a46855c3d6a
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/examples/python/scripted_process/scripted_process.py
    M lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h

  Log Message:
  -----------
  [lldb/Plugins] Add ScriptedProcess::GetThreadsInfo interface

This patch adds a new method to the Scripted Process interface to
retrive a dictionary of Scripted Threads. It uses the thread ID as a key
and the Scripted Thread instance as the value.

This dictionary will be used to create Scripted Threads in lldb and
perform calls to the python scripted thread object.

rdar://87427126

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

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


  Commit: 1b86344fa80bd11853e0347ea33dc6cb5a460c4f
      https://github.com/llvm/llvm-project/commit/1b86344fa80bd11853e0347ea33dc6cb5a460c4f
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
    M lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h

  Log Message:
  -----------
  [lldb/Plugins] Move ScriptedThreadInterface to ScriptedThread

Since we can have multiple Scripted Threads per Scripted Process, having
only a single ScriptedThreadInterface (with a single object instance)
will cause the method calls to be done on the wrong object.

Instead, this patch creates a separate ScriptedThreadInterface for each
new lldb_private::ScriptedThread to make sure we interact with the right
instance.

rdar://87427911

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

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


  Commit: d3e0f7e1503b1bca8baa6483d3b5c452a91f60a6
      https://github.com/llvm/llvm-project/commit/d3e0f7e1503b1bca8baa6483d3b5c452a91f60a6
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/examples/python/scripted_process/scripted_process.py
    M lldb/include/lldb/Interpreter/ScriptedInterface.h
    M lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.h
    M lldb/test/API/functionalities/scripted_process/Makefile
    M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
    M lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
    R lldb/test/API/functionalities/scripted_process/main.c
    A lldb/test/API/functionalities/scripted_process/main.cpp
    M lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py

  Log Message:
  -----------
  [lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess

This patch adds support of multiple Scripted Threads in a ScriptedProcess.

This is done by fetching the Scripted Threads info dictionary at every
ScriptedProcess::DoUpdateThreadList and iterate over each element to
create a new ScriptedThread using the object instance, if it was not
already available.

This patch also adds the ability to pass a pointer of a script interpreter
object instance to initialize a ScriptedInterface instead of having to call
the script object initializer in the ScriptedInterface constructor.

This is used to instantiate the ScriptedThreadInterface from the
ScriptedThread constructor, to be able to perform call on that script
interpreter object instance.

Finally, the patch also updates the scripted process test to check for
multiple threads.

rdar://84507704

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

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


  Commit: cfa55bfe781474a30467b1bbf2e7874985171196
      https://github.com/llvm/llvm-project/commit/cfa55bfe781474a30467b1bbf2e7874985171196
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
    M lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py

  Log Message:
  -----------
  [lldb/Plugins] Enrich ScriptedThreads Stop Reasons with Exceptions

This patch adds Exceptions to the list of supported stop reasons for
Scripted Threads.

The main motivation for this is that breakpoints are triggered as a
special exception class on ARM platforms, so adding it as a stop reason
allows the ScriptedProcess to selected the ScriptedThread that stopped at
a breakpoint (or crashed :p).

rdar://87430376

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

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


  Commit: 45148bfe8aece6ca319dcc32351e20bba26b2ea7
      https://github.com/llvm/llvm-project/commit/45148bfe8aece6ca319dcc32351e20bba26b2ea7
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/include/lldb/Target/Thread.h
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedThread.h
    M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedThreadPythonInterface.cpp

  Log Message:
  -----------
  [lldb/Plugins] Fix ScriptedThread IndexID reporting

When listing all the Scripted Threads of a ScriptedProcess, we can see that all
have the thread index set to 1. This is caused by the lldb_private::Thread
constructor, which sets the m_index_id member using the provided thread id `tid`.

Because the call to the super constructor is done before instantiating
the `ScriptedThreadInterface`, lldb can't fetch the thread id from the
script instance, so it uses `LLDB_INVALID_THREAD_ID` instead.

To mitigate this, this patch takes advantage of the `ScriptedThread::Create`
fallible constructor idiom to defer calling the `ScriptedThread` constructor
(and the `Thread` super constructor with it), until we can fetch a valid
thread id `tid` from the `ScriptedThreadInterface`.

rdar://87432065

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

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


  Commit: 91bb116190cdc598863a7a3fda57e431dd832449
      https://github.com/llvm/llvm-project/commit/91bb116190cdc598863a7a3fda57e431dd832449
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2022-01-24 (Mon, 24 Jan 2022)

  Changed paths:
    M lldb/include/lldb/Interpreter/ScriptedInterface.h
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp

  Log Message:
  -----------
  [lldb/Interpreter] Make `ScriptedInterface::ErrorWithMessage` static (NFC)

This patch changes the `ScriptedInterface::ErrorWithMessage` method to
make it `static` which makes it easier to call.

The patch also updates its various call sites to reflect this change.

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

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


Compare: https://github.com/llvm/llvm-project/compare/c27f8fb96882...91bb116190cd


More information about the All-commits mailing list