[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Thu Feb 6 12:48:14 PST 2025
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/126128
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.
>From 8f9cc6d461c1297633d41f4b05a4572a693c018c Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan <fpiovezan at apple.com>
Date: Thu, 6 Feb 2025 12:38:34 -0800
Subject: [PATCH] [lldb] Add missing return statements in ThreadMemory
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.
---
lldb/source/Plugins/Process/Utility/ThreadMemory.h | 6 +++---
.../plugins/python_os_plugin/TestPythonOSPlugin.py | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
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(
More information about the lldb-commits
mailing list