[all-commits] [llvm/llvm-project] e6cac1: [lldb] Extend SWIG SBProcess interface with WriteM...
Med Ismail Bennani via All-commits
all-commits at lists.llvm.org
Fri Mar 3 19:33:22 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e6cac17b563f2e2bc7d04347b0b40a9fe12334c9
https://github.com/llvm/llvm-project/commit/e6cac17b563f2e2bc7d04347b0b40a9fe12334c9
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/bindings/interface/SBProcessExtensions.i
M lldb/test/API/python_api/process/TestProcessAPI.py
Log Message:
-----------
[lldb] Extend SWIG SBProcess interface with WriteMemoryAsCString method
This patch tries to address an interoperability issue when writing
python string into the process memory.
Since the python string is not null-terminated, it would still be
written to memory however, when trying to read it again with
`SBProcess::ReadCStringFromMemory`, the memory read would fail, since
the read string doens't contain a null-terminator, and therefore is not
a valid C string.
To address that, this patch extends the `SBProcess` SWIG interface to
expose a new `WriteMemoryAsCString` method that is only exposed to the
SWIG target language. That method checks that the buffer to write is
null-terminated and otherwise, it appends a null byte at the end of it.
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: 2d5348be2561402e284e26a9adf3a2e28e70c1f5
https://github.com/llvm/llvm-project/commit/2d5348be2561402e284e26a9adf3a2e28e70c1f5
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
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::GetCapabilities affordance (NFC)
This patch introduces a new method to the Scripted Process interface,
GetCapabilities.
This returns a dictionary that contains a list of flags that the
ScriptedProcess instance supports. This can be used for instance, to
force symbol lookup, when loading dynamic libraries in the scripted process.
Differential Revision: https://reviews.llvm.org/D142059
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: 3014a1c5a130daeb73f6d3b7280c5ceaeadc66a8
https://github.com/llvm/llvm-project/commit/3014a1c5a130daeb73f6d3b7280c5ceaeadc66a8
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/include/lldb/API/SBAttachInfo.h
M lldb/include/lldb/API/SBStructuredData.h
M lldb/include/lldb/Target/Process.h
M lldb/source/API/SBAttachInfo.cpp
M lldb/source/Commands/CMakeLists.txt
M lldb/source/Commands/CommandObjectPlatform.cpp
M lldb/source/Commands/CommandObjectProcess.cpp
A lldb/source/Commands/CommandOptionsProcessAttach.cpp
A lldb/source/Commands/CommandOptionsProcessAttach.h
Log Message:
-----------
[lldb] Add scripted process launch/attach option to {,platform }process commands
This patch does several things:
First, it refactors the `CommandObject{,Platform}ProcessObject` command
option class into a separate `CommandOptionsProcessAttach` option group.
This will make sure both the `platform process attach` and `process attach`
command options will always stay in sync without having with duplicate
them each time. But more importantly, making this class an `OptionGroup`
allows us to combine with a `OptionGroupPythonClassWithDict` to add
support for the scripted process managing class name and user-provided
dictionary options.
This patch also improves feature parity between `ProcessLaunchInfo` and
`ProcessAttachInfo` with regard to ScriptedProcesses, by exposing the
various getters and setters necessary to use them through the SBAPI.
This is foundation work for adding support to "attach" to a process from
the scripted platform.
Differential Revision: https://reviews.llvm.org/D139945
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: b9d4c94a603d3cc1f44ab7dd1d4f3ae9c80da98b
https://github.com/llvm/llvm-project/commit/b9d4c94a603d3cc1f44ab7dd1d4f3ae9c80da98b
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/bindings/python/python-swigsafecast.swig
M lldb/bindings/python/python-wrapper.swig
M lldb/examples/python/scripted_process/scripted_process.py
M lldb/include/lldb/API/SBAttachInfo.h
M lldb/include/lldb/API/SBLaunchInfo.h
M lldb/include/lldb/Host/ProcessLaunchInfo.h
M lldb/include/lldb/Interpreter/ScriptInterpreter.h
M lldb/include/lldb/Interpreter/ScriptedMetadata.h
M lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
M lldb/include/lldb/Target/Process.h
M lldb/include/lldb/Target/Target.h
M lldb/include/lldb/Utility/ProcessInfo.h
M lldb/include/lldb/lldb-forward.h
M lldb/source/API/SBAttachInfo.cpp
M lldb/source/API/SBLaunchInfo.cpp
M lldb/source/API/SBTarget.cpp
M lldb/source/Commands/CommandObjectPlatform.cpp
M lldb/source/Commands/CommandObjectProcess.cpp
M lldb/source/Host/common/ProcessLaunchInfo.cpp
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/ScriptInterpreter/Python/SWIGPythonBridge.h
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.cpp
M lldb/source/Plugins/ScriptInterpreter/Python/ScriptedPythonInterface.h
M lldb/source/Target/Target.cpp
M lldb/source/Utility/ProcessInfo.cpp
M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
M lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Log Message:
-----------
[lldb/Plugins] Add Attach capabilities to ScriptedProcess
This patch adds process attach capabilities to the ScriptedProcess
plugin. This doesn't really expects a PID or process name, since the
process state is already script, however, this allows to create a
scripted process without requiring to have an executuble in the target.
In order to do so, this patch also turns the scripted process related
getters and setters from the `ProcessLaunchInfo` and
`ProcessAttachInfo` classes to a `ScriptedMetadata` instance and moves
it in the `ProcessInfo` class, so it can be accessed interchangeably.
This also adds the necessary SWIG wrappers to convert the internal
`Process{Attach,Launch}InfoSP` into a `SB{Attach,Launch}Info` to pass it
as argument the scripted process python implementation and convert it
back to the internal representation.
rdar://104577406
Differential Revision: https://reviews.llvm.org/D143104
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: e02a355f9846d5ec9cd64b086674770ecc795c26
https://github.com/llvm/llvm-project/commit/e02a355f9846d5ec9cd64b086674770ecc795c26
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/examples/python/scripted_process/crashlog_scripted_process.py
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
M lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
M lldb/test/API/functionalities/scripted_process/invalid_scripted_process.py
M lldb/test/API/functionalities/scripted_process/stack_core_scripted_process.py
Log Message:
-----------
[lldb/Plugins] Clean-up Scripted Process interface requirements (NFC)
The goal of the simple patch is to clean-up the scripted process
interface by removing methods that were introduced with the interface
originally, but that were never really implemented (get_thread_with_id &
get_registers_for_thread).
This patch also changes `get_memory_region_containing_address` to have a
base implementation (that retunrs `None`), instead of forcing the user
to override it in their derived class.
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: f190ec6882706d30c606e62986512371925288a9
https://github.com/llvm/llvm-project/commit/f190ec6882706d30c606e62986512371925288a9
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/bindings/python/python-swigsafecast.swig
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/SWIGPythonBridge.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
M lldb/source/Target/Memory.cpp
M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
M lldb/test/API/functionalities/scripted_process/dummy_scripted_process.py
M lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp
Log Message:
-----------
[lldb/Plugins] Add memory writing capabilities to Scripted Process
This patch adds memory writing capabilities to the Scripted Process plugin.
This allows to user to get a target address and a memory buffer on the
python scripted process implementation that the user can make processing
on before performing the actual write.
This will also be used to write trap instruction to a real process
memory to set a breakpoint.
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: efc52361ddb7282825f1f813553f322bd119b830
https://github.com/llvm/llvm-project/commit/efc52361ddb7282825f1f813553f322bd119b830
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/include/lldb/Interpreter/ScriptedInterface.h
Log Message:
-----------
[lldb] Improve error reporting in ScriptedInterface
This patch improve error reporting in the Scripted Interface.
Previously, it would only log the content of the Status object and
overwrite it with the error_msg function parameter.
This patch changes that to append the Status object content to the
`error_msg` string.
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Commit: ebdbc26a3e79e64e9b2786a8b413618a5b5c115d
https://github.com/llvm/llvm-project/commit/ebdbc26a3e79e64e9b2786a8b413618a5b5c115d
Author: Med Ismail Bennani <medismail.bennani at gmail.com>
Date: 2023-03-03 (Fri, 03 Mar 2023)
Changed paths:
M lldb/bindings/python/python-typemaps.swig
M lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
Log Message:
-----------
[lldb/swig] Fix ref counting issue in SBProcess::GetScriptedImplementation
When using SBProcess::GetScriptedImplementation in python, if the
process has a valid implementation, we returned a reference of the
object without incrementing the reference counting. That causes the
interpreter to crash after accessing the reference several times.
This patch address this by incrementing the reference count when passing
the valid object reference.
Differential Revision: https://reviews.llvm.org/D145260
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Compare: https://github.com/llvm/llvm-project/compare/c7af9ae577bb...ebdbc26a3e79
More information about the All-commits
mailing list