-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[lldb] Add missing return statements in ThreadMemory #126128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Add missing return statements in ThreadMemory #126128
Conversation
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.
@llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) ChangesThese 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:
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(
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that was clearly wrong. Thanks for adding the test.
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. (cherry picked from commit b800293)
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.
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.