llvm-project/lldb/source/Host/CMakeLists.txt

193 lines
4.7 KiB
CMake
Raw Normal View History

macro(add_host_subdirectory group)
list(APPEND HOST_SOURCES ${ARGN})
source_group(${group} FILES ${ARGN})
endmacro()
add_host_subdirectory(common
common/File.cpp
common/FileCache.cpp
common/FileSystem.cpp
common/GetOptInc.cpp
common/Host.cpp
common/HostInfoBase.cpp
common/HostNativeThreadBase.cpp
common/HostProcess.cpp
common/HostThread.cpp
common/LockFileBase.cpp
Re-landing IPv6 support for LLDB Host This support was landed in r300579, and reverted in r300669 due to failures on the bots. The failures were caused by sockets not being properly closed, and this updated version of the patches should resolve that. Summary from the original change: This patch adds IPv6 support to LLDB/Host's TCP socket implementation. Supporting IPv6 involved a few significant changes to the implementation of the socket layers, and I have performed some significant code cleanup along the way. This patch changes the Socket constructors for all types of sockets to not create sockets until first use. This is required for IPv6 support because the socket type will vary based on the address you are connecting to. This also has the benefit of removing code that could have errors from the Socket subclass constructors (which seems like a win to me). The patch also slightly changes the API and behaviors of the Listen/Accept pattern. Previously both Listen and Accept calls took an address specified as a string. Now only listen does. This change was made because the Listen call can result in opening more than one socket. In order to support listening for both IPv4 and IPv6 connections we need to open one AF_INET socket and one AF_INET6 socket. During the listen call we construct a map of file descriptors to addrin structures which represent the allowable incoming connection address. This map removes the need for taking an address into the Accept call. This does have a change in functionality. Previously you could Listen for connections based on one address, and Accept connections from a different address. This is no longer supported. I could not find anywhere in LLDB where we actually used the APIs in that way. The new API does still support AnyAddr for allowing incoming connections from any address. The Listen implementation is implemented using kqueue on FreeBSD and Darwin, WSAPoll on Windows and poll(2) everywhere else. https://reviews.llvm.org/D31823 llvm-svn: 301492
2017-04-27 07:17:20 +08:00
common/MainLoop.cpp
common/MonitoringProcessLauncher.cpp
common/NativeBreakpoint.cpp
common/NativeBreakpointList.cpp
common/NativeWatchpointList.cpp
common/NativeProcessProtocol.cpp
common/NativeRegisterContext.cpp
common/NativeThreadProtocol.cpp
common/OptionParser.cpp
common/PipeBase.cpp
common/ProcessRunLock.cpp
common/PseudoTerminal.cpp
common/Socket.cpp
common/SocketAddress.cpp
common/SoftwareBreakpoint.cpp
common/StringConvert.cpp
common/Symbols.cpp
common/TaskPool.cpp
common/TCPSocket.cpp
common/Terminal.cpp
common/ThreadLauncher.cpp
common/XML.cpp
common/UDPSocket.cpp
)
# Keep track of whether we want to provide a define for the
# Python's architecture-specific lib path (i.e. where a
# Python lldb module would go).
set (get_python_libdir 0)
if (NOT LLDB_DISABLE_LIBEDIT)
add_host_subdirectory(common
common/Editline.cpp
)
endif()
add_host_subdirectory(posix
posix/ConnectionFileDescriptorPosix.cpp
)
if(NOT LLDB_DISABLE_PYTHON)
list(APPEND LLDB_PLUGINS lldbPluginScriptInterpreterPython)
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_host_subdirectory(windows
windows/ConnectionGenericFileWindows.cpp
windows/EditLineWin.cpp
windows/FileSystem.cpp
windows/Host.cpp
windows/HostInfoWindows.cpp
windows/HostProcessWindows.cpp
windows/HostThreadWindows.cpp
windows/LockFileWindows.cpp
windows/PipeWindows.cpp
windows/ProcessLauncherWindows.cpp
windows/ProcessRunLock.cpp
windows/Windows.cpp
)
else()
if (NOT LLDB_DISABLE_PYTHON)
# We'll grab the arch-specific python libdir on POSIX systems.
set (get_python_libdir 1)
endif()
add_host_subdirectory(posix
posix/DomainSocket.cpp
posix/FileSystem.cpp
posix/HostInfoPosix.cpp
posix/HostProcessPosix.cpp
posix/HostThreadPosix.cpp
posix/LockFilePosix.cpp
posix/PipePosix.cpp
posix/ProcessLauncherPosixFork.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
add_host_subdirectory(macosx
macosx/Host.mm
macosx/HostInfoMacOSX.mm
macosx/HostThreadMacOSX.mm
macosx/Symbols.cpp
macosx/cfcpp/CFCBundle.cpp
macosx/cfcpp/CFCData.cpp
macosx/cfcpp/CFCMutableArray.cpp
macosx/cfcpp/CFCMutableDictionary.cpp
macosx/cfcpp/CFCMutableSet.cpp
macosx/cfcpp/CFCString.cpp
)
if(IOS)
set_property(SOURCE macosx/Host.mm APPEND PROPERTY
COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android")
add_host_subdirectory(linux
linux/AbstractSocket.cpp
linux/Host.cpp
linux/HostInfoLinux.cpp
linux/LibcGlue.cpp
linux/Support.cpp
)
if (CMAKE_SYSTEM_NAME MATCHES "Android")
add_host_subdirectory(android
android/HostInfoAndroid.cpp
android/LibcGlue.cpp
)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_host_subdirectory(freebsd
freebsd/Host.cpp
freebsd/HostInfoFreeBSD.cpp
)
elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_host_subdirectory(netbsd
netbsd/Host.cpp
netbsd/HostInfoNetBSD.cpp
)
elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_host_subdirectory(openbsd
openbsd/Host.cpp
openbsd/HostInfoOpenBSD.cpp
)
endif()
endif()
if (${get_python_libdir})
# Call a python script to gather the arch-specific libdir for
# modules like the lldb module.
execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/get_relative_lib_dir.py
RESULT_VARIABLE get_libdir_status
OUTPUT_VARIABLE relative_libdir
)
if (get_libdir_status EQUAL 0)
add_definitions(-DLLDB_PYTHON_RELATIVE_LIBDIR="${relative_libdir}")
endif()
endif()
set(EXTRA_LIBS)
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
list(APPEND EXTRA_LIBS kvm)
endif ()
if (APPLE)
list(APPEND EXTRA_LIBS xml2)
else ()
if (LIBXML2_FOUND)
list(APPEND EXTRA_LIBS ${LIBXML2_LIBRARIES})
endif()
endif ()
if (HAVE_LIBDL)
list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
endif()
if (NOT LLDB_DISABLE_LIBEDIT)
list(APPEND EXTRA_LIBS edit)
endif()
add_lldb_library(lldbHost
${HOST_SOURCES}
LINK_LIBS
lldbCore
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
${LLDB_PLUGINS}
${EXTRA_LIBS}
LINK_COMPONENTS
Support
)