[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 6 12:48:52 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Felipe de Azevedo Piovezan (felipepiovezan)
<details>
<summary>Changes</summary>
These prevented ThreadMemory from correctly returning the Name/Queue/Info of the backing thread.
Note about testing: this test only finds regressions if the system sets a name or queue for the backing thread. While this may not be true everywhere, it still provides coverage in some systems, e.g. in Apple platforms.
---
Full diff: https://github.com/llvm/llvm-project/pull/126128.diff
2 Files Affected:
- (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.h (+3-3)
- (modified) lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py (+6)
``````````diff
diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
index 1e309671e85c653..cebb31538eaf20c 100644
--- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h
+++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h
@@ -33,7 +33,7 @@ class ThreadMemory : public lldb_private::Thread {
const char *GetInfo() override {
if (m_backing_thread_sp)
- m_backing_thread_sp->GetInfo();
+ return m_backing_thread_sp->GetInfo();
return nullptr;
}
@@ -41,7 +41,7 @@ class ThreadMemory : public lldb_private::Thread {
if (!m_name.empty())
return m_name.c_str();
if (m_backing_thread_sp)
- m_backing_thread_sp->GetName();
+ return m_backing_thread_sp->GetName();
return nullptr;
}
@@ -49,7 +49,7 @@ class ThreadMemory : public lldb_private::Thread {
if (!m_queue.empty())
return m_queue.c_str();
if (m_backing_thread_sp)
- m_backing_thread_sp->GetQueueName();
+ return m_backing_thread_sp->GetQueueName();
return nullptr;
}
diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
index 3ad7539018d5d83..fe78edd98f4d4be 100644
--- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
+++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
@@ -160,6 +160,8 @@ def run_python_os_step(self):
)
self.assertTrue(process, PROCESS_IS_VALID)
+ core_thread_zero = process.GetThreadAtIndex(0)
+
# Make sure there are no OS plug-in created thread when we first stop
# at our breakpoint in main
thread = process.GetThreadByID(0x111111111)
@@ -183,6 +185,10 @@ def run_python_os_step(self):
thread.IsValid(),
"Make sure there is a thread 0x111111111 after we load the python OS plug-in",
)
+ # This OS plugin does not set thread names / queue names, so it should
+ # inherit the core thread's name.
+ self.assertEqual(core_thread_zero.GetName(), thread.GetName())
+ self.assertEqual(core_thread_zero.GetQueueName(), thread.GetQueueName())
frame = thread.GetFrameAtIndex(0)
self.assertTrue(
``````````
</details>
https://github.com/llvm/llvm-project/pull/126128
More information about the lldb-commits
mailing list