From b19d3b092d4ea019dfc52501bb96b0008d4e01d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ant=C3=B3nio=20Afonso?= Date: Sun, 21 Feb 2021 10:38:25 -0800 Subject: [PATCH] Revert "Make sure the interpreter module was loaded before making checks against it" This reverts commit a83a825e9902b54b315870e9ed85723525208f09. --- lldb/packages/Python/lldbsuite/test/decorators.py | 4 -- .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 1 - .../functionalities/module_load_attach/Makefile | 10 ----- .../module_load_attach/TestModuleLoadAttach.py | 49 ---------------------- .../functionalities/module_load_attach/feature.c | 1 - .../API/functionalities/module_load_attach/main.c | 15 ------- 6 files changed, 80 deletions(-) delete mode 100644 lldb/test/API/functionalities/module_load_attach/Makefile delete mode 100644 lldb/test/API/functionalities/module_load_attach/TestModuleLoadAttach.py delete mode 100644 lldb/test/API/functionalities/module_load_attach/feature.c delete mode 100644 lldb/test/API/functionalities/module_load_attach/main.c diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py index 628b030..6d781de 100644 --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -622,10 +622,6 @@ def skipUnlessDarwin(func): """Decorate the item to skip tests that should be skipped on any non Darwin platform.""" return skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples())(func) -def skipUnlessLinux(func): - """Decorate the item to skip tests that should be skipped on any non-Linux platform.""" - return skipUnlessPlatform(["linux"])(func) - def skipUnlessTargetAndroid(func): return unittest2.skipUnless(lldbplatformutil.target_is_android(), "requires target to be Android")(func) diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 720fc16..160faa7 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -441,7 +441,6 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() { if (module_sp.get()) { if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress( &m_process->GetTarget()) == m_interpreter_base && - m_interpreter_module.lock() && module_sp != m_interpreter_module.lock()) { // If this is a duplicate instance of ld.so, unload it. We may end up // with it if we load it via a different path than before (symlink diff --git a/lldb/test/API/functionalities/module_load_attach/Makefile b/lldb/test/API/functionalities/module_load_attach/Makefile deleted file mode 100644 index 7b7435f..0000000 --- a/lldb/test/API/functionalities/module_load_attach/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -C_SOURCES := main.c -LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)" -USE_LIBDL := 1 - -feature: - $(MAKE) -f $(MAKEFILE_RULES) \ - DYLIB_ONLY=YES DYLIB_NAME=feature DYLIB_C_SOURCES=feature.c -all: feature - -include Makefile.rules diff --git a/lldb/test/API/functionalities/module_load_attach/TestModuleLoadAttach.py b/lldb/test/API/functionalities/module_load_attach/TestModuleLoadAttach.py deleted file mode 100644 index 71759dc..0000000 --- a/lldb/test/API/functionalities/module_load_attach/TestModuleLoadAttach.py +++ /dev/null @@ -1,49 +0,0 @@ -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - -class TestCase(TestBase): - - mydir = TestBase.compute_mydir(__file__) - - def build_launch_and_attach(self): - self.build() - # launch - exe = self.getBuildArtifact("a.out") - popen = self.spawnSubprocess(exe) - # attach - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - listener = lldb.SBListener("my.attach.listener") - error = lldb.SBError() - process = target.AttachToProcessWithID(listener, popen.pid, error) - self.assertTrue(error.Success() and process, PROCESS_IS_VALID) - return process - - def assertModuleIsLoaded(self, module_name): - feature_module = self.dbg.GetSelectedTarget().FindModule(lldb.SBFileSpec(module_name)) - self.assertTrue(feature_module.IsValid(), f"Module {module_name} should be loaded") - - def assertModuleIsNotLoaded(self, module_name): - feature_module = self.dbg.GetSelectedTarget().FindModule(lldb.SBFileSpec(module_name)) - self.assertFalse(feature_module.IsValid(), f"Module {module_name} should not be loaded") - - @skipIfRemote - @skipUnlessLinux - @no_debug_info_test - def test(self): - ''' - This test makes sure that after attach lldb still gets notifications - about new modules being loaded by the process - ''' - process = self.build_launch_and_attach() - thread = process.GetSelectedThread() - self.assertModuleIsNotLoaded("libfeature.so") - thread.GetSelectedFrame().EvaluateExpression("flip_to_1_to_continue = 1") - # Continue so that dlopen is called. - breakpoint = self.target().BreakpointCreateBySourceRegex( - "// break after dlopen", lldb.SBFileSpec("main.c")) - self.assertNotEqual(breakpoint.GetNumResolvedLocations(), 0) - stopped_threads = lldbutil.continue_to_breakpoint(self.process(), breakpoint) - self.assertModuleIsLoaded("libfeature.so") diff --git a/lldb/test/API/functionalities/module_load_attach/feature.c b/lldb/test/API/functionalities/module_load_attach/feature.c deleted file mode 100644 index 1223120..0000000 --- a/lldb/test/API/functionalities/module_load_attach/feature.c +++ /dev/null @@ -1 +0,0 @@ -extern void feature() {} diff --git a/lldb/test/API/functionalities/module_load_attach/main.c b/lldb/test/API/functionalities/module_load_attach/main.c deleted file mode 100644 index 6953b64..0000000 --- a/lldb/test/API/functionalities/module_load_attach/main.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -volatile int flip_to_1_to_continue = 0; - -int main() { - lldb_enable_attach(); - while (! flip_to_1_to_continue) // Wait for debugger to attach - sleep(1); - // dlopen the feature - void *feature = dlopen("libfeature.so", RTLD_NOW); - assert(feature && "dlopen failed?"); - return 0; // break after dlopen -} -- 2.7.4