Index: lldb/trunk/lldb.xcodeproj/project.pbxproj =================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj +++ lldb/trunk/lldb.xcodeproj/project.pbxproj @@ -633,7 +633,6 @@ 26CEB5F218762056008F575A /* CommandObjectGUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26CEB5F018762056008F575A /* CommandObjectGUI.cpp */; }; 26CFDCA3186163A4000E63E5 /* Editline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26CFDCA2186163A4000E63E5 /* Editline.cpp */; }; 26CFDCA818616473000E63E5 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C32A10F3DFDD009D5894 /* libedit.dylib */; }; - 26D1803E16CEBFD300EDFB5B /* KQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D1803C16CEBFD300EDFB5B /* KQueue.cpp */; }; 26D1804216CEDF0700EDFB5B /* TimeSpecTimeout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp */; }; 26D265BC136B4269002EEE45 /* lldb-public.h in Headers */ = {isa = PBXBuildFile; fileRef = 26651A14133BEC76005B64B7 /* lldb-public.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26D52C1F1A980FE300E5D2FB /* MICmdCmdSymbol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D52C1D1A980FE300E5D2FB /* MICmdCmdSymbol.cpp */; }; @@ -2253,9 +2252,7 @@ 26D0DD5310FE555900271C65 /* BreakpointResolverAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverAddress.cpp; path = source/Breakpoint/BreakpointResolverAddress.cpp; sourceTree = ""; }; 26D0DD5410FE555900271C65 /* BreakpointResolverFileLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverFileLine.cpp; path = source/Breakpoint/BreakpointResolverFileLine.cpp; sourceTree = ""; }; 26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; }; - 26D1803C16CEBFD300EDFB5B /* KQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KQueue.cpp; path = source/Utility/KQueue.cpp; sourceTree = ""; }; 26D1804016CEDF0700EDFB5B /* TimeSpecTimeout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TimeSpecTimeout.cpp; path = source/Utility/TimeSpecTimeout.cpp; sourceTree = ""; }; - 26D1804416CEE12500EDFB5B /* KQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KQueue.h; path = source/Utility/KQueue.h; sourceTree = ""; }; 26D1804616CEE12C00EDFB5B /* TimeSpecTimeout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TimeSpecTimeout.h; path = source/Utility/TimeSpecTimeout.h; sourceTree = ""; }; 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFHeader.cpp; sourceTree = ""; }; 26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFHeader.h; sourceTree = ""; }; @@ -4227,8 +4224,6 @@ 942829551A89614C00521B30 /* JSON.cpp */, 943BDEFC1AA7B2DE00789CE8 /* LLDBAssert.h */, 943BDEFD1AA7B2F800789CE8 /* LLDBAssert.cpp */, - 26D1804416CEE12500EDFB5B /* KQueue.h */, - 26D1803C16CEBFD300EDFB5B /* KQueue.cpp */, 3F81691C1ABA242B001DA9DF /* NameMatches.h */, 3F8169181ABA2419001DA9DF /* NameMatches.cpp */, 94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */, @@ -7536,7 +7531,6 @@ 26DB3E1C1379E7AD0080DC73 /* ABIMacOSX_i386.cpp in Sources */, 26DB3E1F1379E7AD0080DC73 /* ABISysV_x86_64.cpp in Sources */, 232CB61D191E00CD00EF39FC /* SoftwareBreakpoint.cpp in Sources */, - 26D1803E16CEBFD300EDFB5B /* KQueue.cpp in Sources */, 26A69C5F137A17A500262477 /* RegisterValue.cpp in Sources */, 2690B3711381D5C300ECFBAE /* Memory.cpp in Sources */, 4C562CC71CC07DF700C52EAC /* PDBASTParser.cpp in Sources */, Index: lldb/trunk/source/Utility/CMakeLists.txt =================================================================== --- lldb/trunk/source/Utility/CMakeLists.txt +++ lldb/trunk/source/Utility/CMakeLists.txt @@ -3,7 +3,6 @@ ARM64_DWARF_Registers.cpp ConvertEnum.cpp JSON.cpp - KQueue.cpp LLDBAssert.cpp ModuleCache.cpp NameMatches.cpp Index: lldb/trunk/source/Utility/KQueue.h =================================================================== --- lldb/trunk/source/Utility/KQueue.h +++ lldb/trunk/source/Utility/KQueue.h @@ -1,53 +0,0 @@ -//===--------------------- KQueue.h -----------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef utility_KQueue_h_ -#define utility_KQueue_h_ - -#if defined(__APPLE__) -#define LLDB_USE_KQUEUES -#endif - -#ifdef LLDB_USE_KQUEUES - -#include -#include -#include - -#include "lldb/lldb-defines.h" - -namespace lldb_private { - -class KQueue { -public: - KQueue() : m_fd(-1) {} - - ~KQueue() { Close(); } - - bool IsValid() const { return m_fd >= 0; } - - int GetFD(bool can_create); - - int Close(); - - bool AddFDEvent(int fd, bool read, bool write, bool vnode); - - int WaitForEvents( - struct kevent *events, int num_events, Error &error, - uint32_t timeout_usec = UINT32_MAX); // UINT32_MAX means infinite timeout - -protected: - int m_fd; // The kqueue fd -}; - -} // namespace lldb_private - -#endif // #ifdef LLDB_USE_KQUEUES - -#endif // #ifndef utility_KQueue_h_ Index: lldb/trunk/source/Utility/KQueue.cpp =================================================================== --- lldb/trunk/source/Utility/KQueue.cpp +++ lldb/trunk/source/Utility/KQueue.cpp @@ -1,76 +0,0 @@ -//===--------------------- KQueue.cpp ---------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "KQueue.h" - -#ifdef LLDB_USE_KQUEUES - -#include "lldb/Core/Error.h" - -#include "Utility/TimeSpecTimeout.h" - -using namespace lldb_private; - -int KQueue::GetFD(bool can_create) { - if (!IsValid() && can_create) - m_fd = kqueue(); - return m_fd; -} - -int KQueue::Close() { - const int fd = m_fd; - if (fd >= 0) { - m_fd = -1; - return close(fd); - } - return 0; -} - -int KQueue::WaitForEvents(struct kevent *events, int num_events, Error &error, - uint32_t timeout_usec) { - const int fd_kqueue = GetFD(false); - if (fd_kqueue >= 0) { - TimeSpecTimeout timeout; - const struct timespec *timeout_ptr = - timeout.SetRelativeTimeoutMircoSeconds32(timeout_usec); - int result = ::kevent(fd_kqueue, NULL, 0, events, num_events, timeout_ptr); - if (result == -1) - error.SetErrorToErrno(); - else - error.Clear(); - return result; - } else { - error.SetErrorString("invalid kqueue fd"); - } - return 0; -} - -bool KQueue::AddFDEvent(int fd, bool read, bool write, bool vnode) { - const int fd_kqueue = GetFD(true); - if (fd_kqueue >= 0) { - struct kevent event; - event.ident = fd; - event.filter = 0; - if (read) - event.filter |= EVFILT_READ; - if (write) - event.filter |= EVFILT_WRITE; - if (vnode) - event.filter |= EVFILT_VNODE; - event.flags = EV_ADD | EV_CLEAR; - event.fflags = 0; - event.data = 0; - event.udata = NULL; - int err = ::kevent(fd_kqueue, &event, 1, NULL, 0, NULL); - return err == 0; - } - return false; -} - -#endif