diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2025-12-07 15:15:22 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2026-04-25 14:08:55 +0000 |
| commit | 700637cbb5e582861067a11aaca4d053546871d2 (patch) | |
| tree | ab6bc1bd44df7c10d03c5bfb24e6fab6446f32ee /contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp | |
| parent | 6243d755fb82e62d2a3a2e031801e0443150454a (diff) | |
| parent | 3f709e42e3be0f28a88ca3e77663a02b52c914f4 (diff) | |
Merge llvm-project main llvmorg-21-init-19288-gface93e724f4
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-21-init-19288-gface93e724f4, the
last commit before the upstream release/21.x branch was created.
PR: 292067
MFC after: 1 month
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp')
| -rw-r--r-- | contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp index 313c597ce48f..f5fc337a8028 100644 --- a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedProcessPythonInterface.cpp @@ -6,22 +6,27 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Core/PluginManager.h" #include "lldb/Host/Config.h" -#if LLDB_ENABLE_PYTHON -// LLDB Python header must be included first -#include "../lldb-python.h" -#endif -#include "lldb/Target/Process.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" #if LLDB_ENABLE_PYTHON +// clang-format off +// LLDB Python header must be included first +#include "../lldb-python.h" + #include "../SWIGPythonBridge.h" #include "../ScriptInterpreterPythonImpl.h" -#include "ScriptedProcessPythonInterface.h" #include "ScriptedThreadPythonInterface.h" +#include "ScriptedProcessPythonInterface.h" + +// Included in this position to prevent redefinition of pid_t on Windows. +#include "lldb/Target/Process.h" +//clang-format off + #include <optional> using namespace lldb; @@ -106,7 +111,7 @@ bool ScriptedProcessPythonInterface::CreateBreakpoint(lldb::addr_t addr, // If there was an error on the python call, surface it to the user. if (py_error.Fail()) - error = py_error; + error = std::move(py_error); if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj, error)) @@ -123,7 +128,7 @@ lldb::DataExtractorSP ScriptedProcessPythonInterface::ReadMemoryAtAddress( // If there was an error on the python call, surface it to the user. if (py_error.Fail()) - error = py_error; + error = std::move(py_error); return data_sp; } @@ -140,7 +145,7 @@ lldb::offset_t ScriptedProcessPythonInterface::WriteMemoryAtAddress( // If there was an error on the python call, surface it to the user. if (py_error.Fail()) - error = py_error; + error = std::move(py_error); return obj->GetUnsignedIntegerValue(LLDB_INVALID_OFFSET); } @@ -208,4 +213,24 @@ StructuredData::DictionarySP ScriptedProcessPythonInterface::GetMetadata() { return dict; } +void ScriptedProcessPythonInterface::Initialize() { + const std::vector<llvm::StringRef> ci_usages = { + "process attach -C <script-name> [-k key -v value ...]", + "process launch -C <script-name> [-k key -v value ...]"}; + const std::vector<llvm::StringRef> api_usages = { + "SBAttachInfo.SetScriptedProcessClassName", + "SBAttachInfo.SetScriptedProcessDictionary", + "SBTarget.Attach", + "SBLaunchInfo.SetScriptedProcessClassName", + "SBLaunchInfo.SetScriptedProcessDictionary", + "SBTarget.Launch"}; + PluginManager::RegisterPlugin( + GetPluginNameStatic(), llvm::StringRef("Mock process state"), + CreateInstance, eScriptLanguagePython, {ci_usages, api_usages}); +} + +void ScriptedProcessPythonInterface::Terminate() { + PluginManager::UnregisterPlugin(CreateInstance); +} + #endif |
