diff options
Diffstat (limited to 'lldb/source/Host')
-rw-r--r-- | lldb/source/Host/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lldb/source/Host/common/DynamicLibrary.cpp | 33 | ||||
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 124 | ||||
-rw-r--r-- | lldb/source/Host/windows/Host.cpp | 22 |
4 files changed, 0 insertions, 180 deletions
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 3fc9dd939e2..18077122540 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -5,7 +5,6 @@ endmacro() add_host_subdirectory(common common/Condition.cpp - common/DynamicLibrary.cpp common/Editline.cpp common/File.cpp common/FileCache.cpp diff --git a/lldb/source/Host/common/DynamicLibrary.cpp b/lldb/source/Host/common/DynamicLibrary.cpp deleted file mode 100644 index 315a675895f..00000000000 --- a/lldb/source/Host/common/DynamicLibrary.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===-- DynamicLibrary.cpp ------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Core/Error.h" -#include "lldb/Host/DynamicLibrary.h" - -using namespace lldb_private; - -DynamicLibrary::DynamicLibrary (const FileSpec& spec, uint32_t options) : m_filespec(spec) -{ - Error err; - m_handle = Host::DynamicLibraryOpen (spec,options,err); - if (err.Fail()) - m_handle = NULL; -} - -bool -DynamicLibrary::IsValid () -{ - return m_handle != NULL; -} - -DynamicLibrary::~DynamicLibrary () -{ - if (m_handle) - Host::DynamicLibraryClose (m_handle); -} diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 770ef0f3cea..0ce42ac7e12 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -664,130 +664,6 @@ Host::ResolveExecutableInBundle (FileSpec &file) #ifndef _WIN32 -// Opaque info that tracks a dynamic library that was loaded -struct DynamicLibraryInfo -{ - DynamicLibraryInfo (const FileSpec &fs, int o, void *h) : - file_spec (fs), - open_options (o), - handle (h) - { - } - - const FileSpec file_spec; - uint32_t open_options; - void * handle; -}; - -void * -Host::DynamicLibraryOpen (const FileSpec &file_spec, uint32_t options, Error &error) -{ - char path[PATH_MAX]; - if (file_spec.GetPath(path, sizeof(path))) - { - int mode = 0; - - if (options & eDynamicLibraryOpenOptionLazy) - mode |= RTLD_LAZY; - else - mode |= RTLD_NOW; - - - if (options & eDynamicLibraryOpenOptionLocal) - mode |= RTLD_LOCAL; - else - mode |= RTLD_GLOBAL; - -#ifdef LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED - if (options & eDynamicLibraryOpenOptionLimitGetSymbol) - mode |= RTLD_FIRST; -#endif - - void * opaque = ::dlopen (path, mode); - - if (opaque) - { - error.Clear(); - return new DynamicLibraryInfo (file_spec, options, opaque); - } - else - { - error.SetErrorString(::dlerror()); - } - } - else - { - error.SetErrorString("failed to extract path"); - } - return NULL; -} - -Error -Host::DynamicLibraryClose (void *opaque) -{ - Error error; - if (opaque == NULL) - { - error.SetErrorString ("invalid dynamic library handle"); - } - else - { - DynamicLibraryInfo *dylib_info = (DynamicLibraryInfo *) opaque; - if (::dlclose (dylib_info->handle) != 0) - { - error.SetErrorString(::dlerror()); - } - - dylib_info->open_options = 0; - dylib_info->handle = 0; - delete dylib_info; - } - return error; -} - -void * -Host::DynamicLibraryGetSymbol (void *opaque, const char *symbol_name, Error &error) -{ - if (opaque == NULL) - { - error.SetErrorString ("invalid dynamic library handle"); - } - else - { - DynamicLibraryInfo *dylib_info = (DynamicLibraryInfo *) opaque; - - void *symbol_addr = ::dlsym (dylib_info->handle, symbol_name); - if (symbol_addr) - { -#ifndef LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED - // This host doesn't support limiting searches to this shared library - // so we need to verify that the match came from this shared library - // if it was requested in the Host::DynamicLibraryOpen() function. - if (dylib_info->open_options & eDynamicLibraryOpenOptionLimitGetSymbol) - { - FileSpec match_dylib_spec (Host::GetModuleFileSpecForHostAddress (symbol_addr)); - if (match_dylib_spec != dylib_info->file_spec) - { - char dylib_path[PATH_MAX]; - if (dylib_info->file_spec.GetPath (dylib_path, sizeof(dylib_path))) - error.SetErrorStringWithFormat ("symbol not found in \"%s\"", dylib_path); - else - error.SetErrorString ("symbol not found"); - return NULL; - } - } -#endif - error.Clear(); - return symbol_addr; - } - else - { - error.SetErrorString(::dlerror()); - } - } - return NULL; -} - FileSpec Host::GetModuleFileSpecForHostAddress (const void *host_addr) { diff --git a/lldb/source/Host/windows/Host.cpp b/lldb/source/Host/windows/Host.cpp index 3f2870cb5fa..bc0f48b49c7 100644 --- a/lldb/source/Host/windows/Host.cpp +++ b/lldb/source/Host/windows/Host.cpp @@ -213,28 +213,6 @@ Host::GetModuleFileSpecForHostAddress (const void *host_addr) return module_filespec; } -void * -Host::DynamicLibraryOpen(const FileSpec &file_spec, uint32_t options, Error &error) -{ - error.SetErrorString("not implemented"); - return NULL; -} - -Error -Host::DynamicLibraryClose (void *opaque) -{ - Error error; - error.SetErrorString("not implemented"); - return error; -} - -void * -Host::DynamicLibraryGetSymbol(void *opaque, const char *symbol_name, Error &error) -{ - error.SetErrorString("not implemented"); - return NULL; -} - uint32_t Host::FindProcesses (const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) { |