From faff1fe25c82f94de548f1a0b12d65bcc8bda4b5 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Sun, 18 Nov 2018 20:48:25 +0000 Subject: Revert "Implement basic DidAttach and DidLaunch for DynamicLoaderWindowsDYLD" This breaks many tests on Windows, which now all fail with an error such as "Unable to read memory at address ". git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@347174 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../test/functionalities/windows_dyld/Makefile | 14 ------- .../windows_dyld/TestWindowsDYLD.py | 42 -------------------- .../test/functionalities/windows_dyld/dllfunc.c | 19 --------- .../test/functionalities/windows_dyld/dllfunc.mk | 7 ---- .../test/functionalities/windows_dyld/main.c | 19 --------- packages/Python/lldbsuite/test/make/Makefile.rules | 4 +- .../Windows-DYLD/DynamicLoaderWindowsDYLD.cpp | 46 +--------------------- 7 files changed, 4 insertions(+), 147 deletions(-) delete mode 100644 packages/Python/lldbsuite/test/functionalities/windows_dyld/Makefile delete mode 100644 packages/Python/lldbsuite/test/functionalities/windows_dyld/TestWindowsDYLD.py delete mode 100644 packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.c delete mode 100644 packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.mk delete mode 100644 packages/Python/lldbsuite/test/functionalities/windows_dyld/main.c diff --git a/packages/Python/lldbsuite/test/functionalities/windows_dyld/Makefile b/packages/Python/lldbsuite/test/functionalities/windows_dyld/Makefile deleted file mode 100644 index 8289e159f..000000000 --- a/packages/Python/lldbsuite/test/functionalities/windows_dyld/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -LEVEL := ../../make - -LD_EXTRAS := -ldllfunc -C_SOURCES := main.c - -include $(LEVEL)/Makefile.rules - -a.out: dllfunc - -dllfunc: - $(MAKE) VERBOSE=1 VPATH=$(SRCDIR) -I $(SRCDIR) -f $(SRCDIR)/dllfunc.mk - -clean:: - $(MAKE) -f $(SRCDIR)/dllfunc.mk clean diff --git a/packages/Python/lldbsuite/test/functionalities/windows_dyld/TestWindowsDYLD.py b/packages/Python/lldbsuite/test/functionalities/windows_dyld/TestWindowsDYLD.py deleted file mode 100644 index 77d4e7109..000000000 --- a/packages/Python/lldbsuite/test/functionalities/windows_dyld/TestWindowsDYLD.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -Test that breakpoints work in a DLL -""" - -from __future__ import print_function - -import lldb -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -@skipUnlessWindows -class WindowsDLLTestCase(TestBase): - def setUP(self): - TestBase.setUp(self) - self.build() - - def test_dll_linking(self): - """test that the debugger works with DLLs""" - - exe = self.getBuildArtifact("a.out") - target = self.dbg.CreateTarget(exe) - self.assertTrue(target and target.IsValid(), "Target is valid") - - self.runCmd("breakpoint set --file main.c --line 16") - self.runCmd("breakpoint set --file dllfunc.c --line 18") - - process = target.LaunchSimple(None, None, self.get_process_working_directory()) - - self.expect("p x", "16") - self.runCmd("thread step-out") - self.expect("p x", "16") - self.expect("thread step-in") - self.expect("thread step-in") - self.expect("p n", "8") - self.runCmd("c") - self.expect("p x", "64") - self.runCmd("breakpoint delete 2") - self.runCmd("c") - - self.assertEqual(process.GetExitStatus(), 336, PROCESS_EXITED) diff --git a/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.c b/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.c deleted file mode 100644 index aadf4e34a..000000000 --- a/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.c +++ /dev/null @@ -1,19 +0,0 @@ -//===-- a.c -----------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -BOOL WINAPI DllMain(HINSTANCE h, DWORD reason, void* reserved) { - return TRUE; -} - -int __declspec(dllexport) DllFunc(int n) { - int x = n * n; - return x; // set breakpoint here -} diff --git a/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.mk b/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.mk deleted file mode 100644 index f282344d3..000000000 --- a/packages/Python/lldbsuite/test/functionalities/windows_dyld/dllfunc.mk +++ /dev/null @@ -1,7 +0,0 @@ -LEVEL := ../../make - -DYLIB_NAME := dllfunc -DYLIB_C_SOURCES := dllfunc.c -DYLIB_ONLY := YES - -include $(LEVEL)/Makefile.rules diff --git a/packages/Python/lldbsuite/test/functionalities/windows_dyld/main.c b/packages/Python/lldbsuite/test/functionalities/windows_dyld/main.c deleted file mode 100644 index 4b62744fb..000000000 --- a/packages/Python/lldbsuite/test/functionalities/windows_dyld/main.c +++ /dev/null @@ -1,19 +0,0 @@ -//===-- main.c --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include - -int __declspec(dllimport) DllFunc(int n); - -int main(int argc, char ** argv) { - int x = DllFunc(4); - int y = DllFunc(8); // set breakpoint here - int z = DllFunc(16); - return x + y + z; -} diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules index 90e1bf71c..f38ee5b1e 100644 --- a/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/packages/Python/lldbsuite/test/make/Makefile.rules @@ -535,7 +535,7 @@ EXE = $(DYLIB_FILENAME) endif else $(EXE) : $(OBJECTS) $(ARCHIVE_NAME) - "$(LD)" $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)" + $(LD) $(OBJECTS) $(LDFLAGS) $(ARCHIVE_NAME) -o "$(EXE)" ifneq "$(CODESIGN)" "" $(CODESIGN) -s - "$(EXE)" endif @@ -592,7 +592,7 @@ ifneq "$(DS)" "" endif endif else - "$(LD)" $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)" + $(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)" ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES" $(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug" $(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)" diff --git a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp index bb52e6b8b..6502d7a7a 100644 --- a/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp +++ b/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp @@ -10,14 +10,12 @@ #include "DynamicLoaderWindowsDYLD.h" -#include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlanStepInstruction.h" -#include "lldb/Utility/Log.h" #include "llvm/ADT/Triple.h" @@ -62,49 +60,9 @@ DynamicLoader *DynamicLoaderWindowsDYLD::CreateInstance(Process *process, return nullptr; } -void DynamicLoaderWindowsDYLD::DidAttach() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - if (log) - log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); +void DynamicLoaderWindowsDYLD::DidAttach() {} - DidLaunch(); - - m_process->LoadModules(); -} - -void DynamicLoaderWindowsDYLD::DidLaunch() { - Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - if (log) - log->Printf("DynamicLoaderWindowsDYLD::%s()", __FUNCTION__); - - ModuleSP executable = GetTargetExecutable(); - - if (!executable.get()) - return; - - // Try to fetch the load address of the file from the process, since there - // could be randomization of the load address. - - // It might happen that the remote has a different dir for the file, so we - // only send the basename of the executable in the query. I think this is safe - // because I doubt that two executables with the same basenames are loaded in - // memory... - FileSpec file_spec( - executable->GetPlatformFileSpec().GetFilename().GetCString()); - bool is_loaded; - addr_t base_addr = 0; - lldb::addr_t load_addr; - Status error = m_process->GetFileLoadAddress(file_spec, is_loaded, load_addr); - if (error.Success() && is_loaded) { - base_addr = load_addr; - } - - UpdateLoadedSections(executable, LLDB_INVALID_ADDRESS, base_addr, false); - - ModuleList module_list; - module_list.Append(executable); - m_process->GetTarget().ModulesDidLoad(module_list); -} +void DynamicLoaderWindowsDYLD::DidLaunch() {} Status DynamicLoaderWindowsDYLD::CanLoadImage() { return Status(); } -- cgit v1.2.3