aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python
diff options
context:
space:
mode:
authorFelipe de Azevedo Piovezan <fpiovezan@apple.com>2025-01-16 15:05:46 -0800
committerGitHub <noreply@github.com>2025-01-16 15:05:46 -0800
commitcb82771c96d7055d89ca67f383e6fb3c9aced178 (patch)
tree26a08cfcd5b6d1201c4db933d1491b8185bfad8a /lldb/source/Plugins/ScriptInterpreter/Python
parentbb6e94a05d15d289e3685c5599f0eb905dc46925 (diff)
downloadllvm-cb82771c96d7055d89ca67f383e6fb3c9aced178.zip
llvm-cb82771c96d7055d89ca67f383e6fb3c9aced178.tar.gz
llvm-cb82771c96d7055d89ca67f383e6fb3c9aced178.tar.bz2
[lldb] Add OS plugin property for reporting all threads (#123145)
Currently, an LLDB target option controls whether plugins report all threads. However, it seems natural for this knowledge could come from the plugin itself. To support this, this commits adds a virtual method to the plugin base class, making the Python OS query the target option to preserve existing behavior.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp10
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
index c3379e7..d8b2ea9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.cpp
@@ -82,6 +82,16 @@ 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>",
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h
index 102c3c3..8df48f1 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/OperatingSystemPythonInterface.h
@@ -45,6 +45,8 @@ public:
std::optional<std::string> GetRegisterContextForTID(lldb::tid_t tid) override;
+ std::optional<bool> DoesPluginReportAllThreads() override;
+
static void Initialize();
static void Terminate();