[Lldb-commits] [PATCH] D117068: [lldb/Plugins] Add ScriptedProcess::GetThreadsInfo interface
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Jan 18 03:49:12 PST 2022
mib updated this revision to Diff 400799.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117068/new/
https://reviews.llvm.org/D117068
Files:
lldb/examples/python/scripted_process/scripted_process.py
lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.h
@@ -39,6 +39,8 @@
GetMemoryRegionContainingAddress(lldb::addr_t address,
Status &error) override;
+ StructuredData::DictionarySP GetThreadsInfo() override;
+
StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid) override;
StructuredData::DictionarySP GetRegistersForThread(lldb::tid_t tid) override;
Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp
@@ -92,6 +92,17 @@
return mem_region;
}
+StructuredData::DictionarySP ScriptedProcessPythonInterface::GetThreadsInfo() {
+ Status error;
+ StructuredData::DictionarySP dict =
+ Dispatch<StructuredData::DictionarySP>("get_threads_info", error);
+
+ if (!CheckStructuredDataObject(LLVM_PRETTY_FUNCTION, dict, error))
+ return {};
+
+ return dict;
+}
+
StructuredData::DictionarySP
ScriptedProcessPythonInterface::GetThreadWithID(lldb::tid_t tid) {
Status error;
Index: lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
===================================================================
--- lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -41,6 +41,8 @@
return {};
}
+ virtual StructuredData::DictionarySP GetThreadsInfo() { return nullptr; }
+
virtual StructuredData::DictionarySP GetThreadWithID(lldb::tid_t tid) {
return nullptr;
}
Index: lldb/examples/python/scripted_process/scripted_process.py
===================================================================
--- lldb/examples/python/scripted_process/scripted_process.py
+++ lldb/examples/python/scripted_process/scripted_process.py
@@ -19,6 +19,7 @@
memory_regions = None
stack_memory_dump = None
loaded_images = None
+ threads = {}
@abstractmethod
def __init__(self, target, args):
@@ -51,6 +52,16 @@
"""
pass
+ def get_threads_info(self):
+ """ Get the dictionary describing the process' Scripted Threads.
+
+ Returns:
+ Dict: The dictionary of threads, with the thread ID as the key and
+ a Scripted Thread instance as the value.
+ The dictionary can be empty.
+ """
+ return self.threads
+
@abstractmethod
def get_thread_with_id(self, tid):
""" Get the scripted process thread with a specific ID.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117068.400799.patch
Type: text/x-patch
Size: 2915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220118/19e1999b/attachment-0001.bin>
More information about the lldb-commits
mailing list