aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2025-12-07 15:15:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2026-04-25 14:08:55 +0000
commit700637cbb5e582861067a11aaca4d053546871d2 (patch)
treeab6bc1bd44df7c10d03c5bfb24e6fab6446f32ee /contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
parent6243d755fb82e62d2a3a2e031801e0443150454a (diff)
parent3f709e42e3be0f28a88ca3e77663a02b52c914f4 (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/OperatingSystemPythonInterface.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
index c162c7367c65..d8b2ea984fd8 100644
--- a/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
+++ b/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
@@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//
+#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Config.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Utility/Log.h"
@@ -13,8 +14,10 @@
#if LLDB_ENABLE_PYTHON
+// clang-format off
// LLDB Python header must be included first
#include "../lldb-python.h"
+//clang-format on
#include "../SWIGPythonBridge.h"
#include "../ScriptInterpreterPythonImpl.h"
@@ -79,4 +82,28 @@ OperatingSystemPythonInterface::GetRegisterContextForTID(lldb::tid_t tid) {
return obj->GetAsString()->GetValue().str();
}
+std::optional<bool> OperatingSystemPythonInterface::DoesPluginReportAllThreads() {
+ Status error;
+ StructuredData::ObjectSP obj = Dispatch("does_plugin_report_all_threads", error);
+ if (!ScriptedInterface::CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, obj,
+ error))
+ return {};
+
+ return obj->GetAsBoolean()->GetValue();
+}
+
+void OperatingSystemPythonInterface::Initialize() {
+ const std::vector<llvm::StringRef> ci_usages = {
+ "settings set target.process.python-os-plugin-path <script-path>",
+ "settings set process.experimental.os-plugin-reports-all-threads [0/1]"};
+ const std::vector<llvm::StringRef> api_usages = {};
+ PluginManager::RegisterPlugin(
+ GetPluginNameStatic(), llvm::StringRef("Mock thread state"),
+ CreateInstance, eScriptLanguagePython, {ci_usages, api_usages});
+}
+
+void OperatingSystemPythonInterface::Terminate() {
+ PluginManager::UnregisterPlugin(CreateInstance);
+}
+
#endif