-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Fix plugin manager test failure on windows #134173
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
Conversation
This is an attempt to fix a test failure from llvm#133794 when running on windows builds. I suspect we are running into a case where the [ICF](https://learn.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-170) optimization kicks in and combines the CreateSystemRuntimePlugin* functions into a single address. This means that we cannot uniquely unregister the plugin based on its create function address. The fix is have each create function return a different (bogus) value.
@llvm/pr-subscribers-lldb Author: David Peixotto (dmpots) ChangesThis is an attempt to fix a test failure from #133794 when running on windows builds. I suspect we are running into a case where the ICF optimization kicks in and combines the CreateSystemRuntimePlugin* functions into a single address. This means that we cannot uniquely unregister the plugin based on its create function address. The fix is have each create function return a different (bogus) value. Full diff: https://github.com/llvm/llvm-project/pull/134173.diff 1 Files Affected:
diff --git a/lldb/unittests/Core/PluginManagerTest.cpp b/lldb/unittests/Core/PluginManagerTest.cpp
index ca1003ca9a85a..9b0ce2286d273 100644
--- a/lldb/unittests/Core/PluginManagerTest.cpp
+++ b/lldb/unittests/Core/PluginManagerTest.cpp
@@ -7,11 +7,21 @@ using namespace lldb;
using namespace lldb_private;
// Mock system runtime plugin create functions.
-SystemRuntime *CreateSystemRuntimePluginA(Process *process) { return nullptr; }
+// Make them all return different values to avoid the ICF optimization
+// from combining them into the same function. The values returned
+// are not valid SystemRuntime pointers, but they are unique and
+// sufficient for testing.
+SystemRuntime *CreateSystemRuntimePluginA(Process *process) {
+ return (SystemRuntime *)0x1;
+}
-SystemRuntime *CreateSystemRuntimePluginB(Process *process) { return nullptr; }
+SystemRuntime *CreateSystemRuntimePluginB(Process *process) {
+ return (SystemRuntime *)0x2;
+}
-SystemRuntime *CreateSystemRuntimePluginC(Process *process) { return nullptr; }
+SystemRuntime *CreateSystemRuntimePluginC(Process *process) {
+ return (SystemRuntime *)0x3;
+}
// Test class for testing the PluginManager.
// The PluginManager modifies global state when registering new plugins. This
@@ -24,6 +34,10 @@ class PluginManagerTest : public testing::Test {
// Add mock system runtime plugins for testing.
void RegisterMockSystemRuntimePlugins() {
+ // Make sure the create functions all have different addresses.
+ ASSERT_NE(CreateSystemRuntimePluginA, CreateSystemRuntimePluginB);
+ ASSERT_NE(CreateSystemRuntimePluginB, CreateSystemRuntimePluginC);
+
ASSERT_TRUE(PluginManager::RegisterPlugin("a", "test instance A",
CreateSystemRuntimePluginA));
ASSERT_TRUE(PluginManager::RegisterPlugin("b", "test instance B",
|
This is my guess on what is causing the test failures. Can revert this and the original PR if it doesn't work. |
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.
Let's try it!
This reverts commit b55bab2.
Revert the below two commits while we investigate the test failures. Revert "[lldb] Fix plugin manager test failure on windows (llvm#134173)" This reverts commit b55bab2. Revert "Add enable/disable api for SystemRuntime plugins (llvm#133794)" This reverts commit 2026873.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15362 Here is the relevant piece of the build log for the reference
|
Hmm, not sure if this is related. This PR was a test only change so I wouldn't expect these kinds of failures. #134183 has a revert if we need it |
The windows bots are now passing on this test so I think it was ICF that was the problem: https://lab.llvm.org/buildbot/#/changes/32645 |
This is an attempt to fix a test failure from #133794 when running on windows builds. I suspect we are running into a case where the ICF optimization kicks in and combines the CreateSystemRuntimePlugin* functions into a single address. This means that we cannot uniquely unregister the plugin based on its create function address.
The fix is have each create function return a different (bogus) value.