# so that the check isn't duplicated, but we translate them into the LLDB names
# so that I don't have to change all the uses at the moment.
set(LLDB_ENABLE_TERMIOS ${HAVE_TERMIOS_H})
-if(NOT UNIX)
- set(LLDB_DISABLE_POSIX 1)
-endif()
+set(LLDB_ENABLE_POSIX NOT UNIX)
if(NOT LLDB_CONFIG_HEADER_INPUT)
set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake)
#cmakedefine01 LLDB_HAVE_EL_RFUNC_T
-#cmakedefine LLDB_DISABLE_POSIX
#cmakedefine01 HAVE_SYS_TYPES_H
#cmakedefine HAVE_LIBCOMPRESSION
#endif
+#cmakedefine01 LLDB_ENABLE_POSIX
+
#cmakedefine01 LLDB_ENABLE_TERMIOS
#cmakedefine01 LLDB_ENABLE_LZMA
if (error_str)
error_str[0] = '\0';
-#if !defined(LLDB_DISABLE_POSIX)
+#if LLDB_ENABLE_POSIX
// Open the master side of a pseudo terminal
m_master_fd = ::posix_openpt(oflag);
if (m_master_fd < 0) {
if (error_str)
error_str[0] = '\0';
pid_t pid = LLDB_INVALID_PROCESS_ID;
-#if !defined(LLDB_DISABLE_POSIX)
+#if LLDB_ENABLE_POSIX
int flags = O_RDWR;
flags |= O_CLOEXEC;
if (OpenFirstAvailableMaster(flags, error_str, error_len)) {
#include "llvm/Support/Error.h"
#include "llvm/Support/WindowsError.h"
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include "lldb/Host/posix/DomainSocket.h"
#include <arpa/inet.h>
std::make_unique<UDPSocket>(true, child_processes_inherit);
break;
case ProtocolUnixDomain:
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
socket_up =
std::make_unique<DomainSocket>(true, child_processes_inherit);
#else
#include "llvm/Support/Errno.h"
#include "llvm/Support/raw_ostream.h"
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
// Loop until we are happy with our connection
while (!accept_connection) {
accept_loop.Run();
-
+
if (error.Fail())
return error;
bool TerminalState::Save(int fd, bool save_process_group) {
m_tty.SetFileDescriptor(fd);
if (m_tty.IsATerminal()) {
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
m_tflags = ::fcntl(fd, F_GETFL, 0);
#endif
#if LLDB_ENABLE_TERMIOS
if (err != 0)
m_termios_up.reset();
#endif // #if LLDB_ENABLE_TERMIOS
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
if (save_process_group)
m_process_group = ::tcgetpgrp(0);
else
// Restore the state of the TTY using the cached values from a previous call to
// Save().
bool TerminalState::Restore() const {
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
if (IsValid()) {
const int fd = m_tty.GetFileDescriptor();
if (TFlagsIsValid())
#include "lldb/Host/Config.h"
#include "lldb/Utility/Log.h"
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
#include <string.h>
#include <sys/types.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <termios.h>
#include <unistd.h>
#endif
// unix-abstract-connect://SOCKNAME
return UnixAbstractSocketConnect(*addr, error_ptr);
}
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
else if ((addr = GetURLAddress(path, FD_SCHEME))) {
// Just passing a native file descriptor within this current process that
// is already opened (possibly from a service or other source).
#include "lldb/Host/Config.h"
#include <stdio.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <sys/utsname.h>
#endif
void PlatformFreeBSD::GetStatus(Stream &strm) {
Platform::GetStatus(strm);
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
// Display local kernel information only when we are running in host mode.
// Otherwise, we would end up printing non-FreeBSD information (when running
// on Mac OS for example).
#include "lldb/Host/Config.h"
#include <stdio.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <sys/utsname.h>
#endif
void PlatformLinux::GetStatus(Stream &strm) {
Platform::GetStatus(strm);
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
// Display local kernel information only when we are running in host mode.
// Otherwise, we would end up printing non-Linux information (when running on
// Mac OS for example).
#include "lldb/Host/Config.h"
#include <stdio.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <sys/utsname.h>
#endif
void PlatformNetBSD::GetStatus(Stream &strm) {
Platform::GetStatus(strm);
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
// Display local kernel information only when we are running in host mode.
// Otherwise, we would end up printing non-NetBSD information (when running
// on Mac OS for example).
#include "lldb/Host/Config.h"
#include <stdio.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <sys/utsname.h>
#endif
void PlatformOpenBSD::GetStatus(Stream &strm) {
Platform::GetStatus(strm);
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
// Display local kernel information only when we are running in host mode.
// Otherwise, we would end up printing non-OpenBSD information (when running
// on Mac OS for example).
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadPlanCallFunction.h"
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <sys/mman.h>
#else
// define them
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_qUserName(
StringExtractorGDBRemote &packet) {
-#if !defined(LLDB_DISABLE_POSIX)
+#if LLDB_ENABLE_POSIX
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));
LLDB_LOGF(log, "GDBRemoteCommunicationServerCommon::%s begin", __FUNCTION__);
GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerCommon::Handle_qGroupName(
StringExtractorGDBRemote &packet) {
-#if !defined(LLDB_DISABLE_POSIX)
+#if LLDB_ENABLE_POSIX
// Packet format: "qGroupName:%i" where %i is the gid
packet.SetFilePos(::strlen("qGroupName:"));
uint32_t gid = packet.GetU32(UINT32_MAX);
#include <errno.h>
#include <stdlib.h>
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include "LLDBServerUtilities.h"
#include "Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h"
#include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h"
+#include "lldb/Host/Config.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostGetOpt.h"
snprintf(connection_url, sizeof(connection_url), "fd://%d", connection_fd);
// Create the connection.
-#if !defined LLDB_DISABLE_POSIX && !defined _WIN32
+#if LLDB_ENABLE_POSIX && !defined _WIN32
::fcntl(connection_fd, F_SETFD, FD_CLOEXEC);
#endif
connection_up.reset(new ConnectionFileDescriptor);
printf("%s-%s\n", LLGS_PROGRAM_NAME, LLGS_VERSION_STR);
ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port,
- progname, subcommand, named_pipe_path.c_str(),
+ progname, subcommand, named_pipe_path.c_str(),
unnamed_pipe, connection_fd);
if (!gdb_server.IsConnected()) {
//===----------------------------------------------------------------------===//
#include "SocketTestUtilities.h"
+#include "lldb/Host/Config.h"
#include "lldb/Utility/UriParser.h"
#include "gtest/gtest.h"
EXPECT_TRUE(error.Success());
}
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
TEST_F(SocketTest, DomainListenConnectAccept) {
llvm::SmallString<64> Path;
std::error_code EC = llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
EXPECT_EQ(scheme, "udp");
}
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
TEST_F(SocketTest, DomainGetConnectURI) {
llvm::SmallString<64> domain_path;
std::error_code EC =
//===----------------------------------------------------------------------===//
#include "SocketTestUtilities.h"
+#include "lldb/Host/Config.h"
#include "lldb/Utility/StreamString.h"
#ifdef _WIN32
return true;
}
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
void lldb_private::CreateDomainConnectedSockets(
llvm::StringRef path, std::unique_ptr<DomainSocket> *socket_a_up,
std::unique_ptr<DomainSocket> *socket_b_up) {
#include "llvm/Support/Path.h"
#include "llvm/Testing/Support/Error.h"
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
#include "lldb/Host/posix/DomainSocket.h"
#endif
bool CreateTCPConnectedSockets(std::string listen_remote_ip,
std::unique_ptr<TCPSocket> *a_up,
std::unique_ptr<TCPSocket> *b_up);
-#ifndef LLDB_DISABLE_POSIX
+#if LLDB_ENABLE_POSIX
void CreateDomainConnectedSockets(llvm::StringRef path,
std::unique_ptr<DomainSocket> *a_up,
std::unique_ptr<DomainSocket> *b_up);