[all-commits] [llvm/llvm-project] 3675e0: [lldb/API] Introduce SBProcess::ForceScriptedState...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Mon Mar 6 13:14:39 PST 2023


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

  Changed paths:
    M lldb/include/lldb/API/SBProcess.h
    M lldb/include/lldb/Target/Process.h
    M lldb/source/API/SBProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.h

  Log Message:
  -----------
  [lldb/API] Introduce SBProcess::ForceScriptedState method

This patch introduces a new method to the SBProcess API called
ForceScriptedState. As the name suggests, this affordance will allow the
user to alter the private state of the scripted process programatically.

This is necessary to update the scripted process state when perform
interactive debugging.

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

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


  Commit: 3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d
      https://github.com/llvm/llvm-project/commit/3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

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

  Log Message:
  -----------
  [lldb] Move ScriptedProcess private state update to implementation

While debugging a Scripted Process, in order to update its state and
work nicely with lldb's execution model, it needs to toggle its private
state from running to stopped, which will result in broadcasting a
process state changed event to the debugger listener.

Originally, this state update was done systematically in the Scripted
Process C++ plugin, however in order to make scripted process
interactive, we need to be able to update their state dynamically.

This patch makes use of the recent addition of the
`SBProcess::ForceScriptedState` to programatically, and moves the
process private state update to the python implementation of the `resume`
method instead of doing it in `ScriptedProcess::DoResume`.

This patch also removes the unused `ShouldStop` & `Stop` scripted
process APIs, and adds new ScriptedInterface transform methods for
boolean arguments. This allow the user to programmatically decide if
after running the process, we should stop it (which is the default setting).

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

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


  Commit: cfe06f495beb520ab366957d1108bb80c7c92832
      https://github.com/llvm/llvm-project/commit/cfe06f495beb520ab366957d1108bb80c7c92832
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

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

  Log Message:
  -----------
  [lldb/Plugin] Add breakpoint setting support to ScriptedProcesses.

This patch adds support for breakpoint setting to Scripted Processes.

For now, Scripted Processes only support setting software breakpoints.

When doing interactive scripted process debugging, it makes use of the
memory writing capability to write the trap opcodes in the memory of the
driving process. However the real process' target doesn't keep track of
the breakpoints that got added by the scripted process. This is a design
that we might need to change in the future, since we'll probably need to
do some book keeping to handle breakpoints that were set by different
scripted processes.

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

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


  Commit: 70b9822ef3b0774609c72d380504c9abfa717f81
      https://github.com/llvm/llvm-project/commit/70b9822ef3b0774609c72d380504c9abfa717f81
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

  Changed paths:
    A lldb/test/API/functionalities/interactive_scripted_process/Makefile
    A lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py
    A lldb/test/API/functionalities/interactive_scripted_process/main.cpp

  Log Message:
  -----------
  [lldb] Add an example of interactive scripted process debugging (NFC)

This patch is a proof of concept that shows how a scripted process could
be used with real process to perform interactive debugging.

In this example, we run a process that spawns 10 threads. Then, we
create a intermediary scripted process who's job will be to wrap the
real process while intercepting it's process events and dispatching them
back either to the real process or to other child scripted processes.

In this example, we have 2 child scripted processes, with even and odd
thread indices. The goal is to be able to do thread filtering and
explore the various interactive debugging approaches, by letting a child
process running when stopping the other process and inspecting it.
Another approach would be to have the child processes execution in-sync
to force running every child process when one of them starts running.

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


  Commit: 601583e5a3083b87b48bc6747c12dc0027b09481
      https://github.com/llvm/llvm-project/commit/601583e5a3083b87b48bc6747c12dc0027b09481
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

  Changed paths:
    R lldb/include/lldb/Interpreter/ScriptedMetadata.h
    A lldb/include/lldb/Utility/ScriptedMetadata.h
    M lldb/source/API/SBAttachInfo.cpp
    M lldb/source/API/SBLaunchInfo.cpp
    M lldb/source/Commands/CommandObjectPlatform.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.h
    M lldb/source/Utility/ProcessInfo.cpp

  Log Message:
  -----------
  [lldb/Utility] Fix layering violation caused by ScriptedMetadata

This patch moves `ScriptedMetadata.h` from the `Interpreter` directory to
the `Utility` sub-directory since `ProcessInfo.h` depends on it.

It also gets rid of the unused `OptionGroupPythonClassWithDict`
constructor for `ScriptedMetadata` which would address the layering
violation.

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


Compare: https://github.com/llvm/llvm-project/compare/a02c3af9f19d...601583e5a308


More information about the All-commits mailing list