summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/ConnectionFileDescriptor.h119
-rw-r--r--lldb/include/lldb/Host/ConnectionFileDescriptor.h15
-rw-r--r--lldb/include/lldb/Host/Editline.h2
-rw-r--r--lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h104
-rw-r--r--lldb/source/API/SBCommunication.cpp2
-rw-r--r--lldb/source/Core/CMakeLists.txt1
-rw-r--r--lldb/source/Core/Debugger.cpp2
-rw-r--r--lldb/source/Host/CMakeLists.txt4
-rw-r--r--lldb/source/Host/macosx/Host.mm2
-rw-r--r--lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp (renamed from lldb/source/Core/ConnectionFileDescriptor.cpp)436
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp2
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp2
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp2
-rw-r--r--lldb/source/Target/Process.cpp6
-rw-r--r--lldb/tools/lldb-gdbserver/lldb-gdbserver.cpp2
-rw-r--r--lldb/tools/lldb-platform/lldb-platform.cpp2
20 files changed, 341 insertions, 370 deletions
diff --git a/lldb/include/lldb/Core/ConnectionFileDescriptor.h b/lldb/include/lldb/Core/ConnectionFileDescriptor.h
deleted file mode 100644
index 6882b2838e9..00000000000
--- a/lldb/include/lldb/Core/ConnectionFileDescriptor.h
+++ /dev/null
@@ -1,119 +0,0 @@
-//===-- ConnectionFileDescriptor.h ------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_ConnectionFileDescriptor_h_
-#define liblldb_ConnectionFileDescriptor_h_
-
-// C++ Includes
-#include <atomic>
-#include <memory>
-
-#include "lldb/lldb-forward.h"
-
-// Other libraries and framework includes
-// Project includes
-#include "lldb/Core/Connection.h"
-#include "lldb/Host/Mutex.h"
-#include "lldb/Host/Pipe.h"
-#include "lldb/Host/Predicate.h"
-#include "lldb/Host/IOObject.h"
-
-namespace lldb_private {
-
-class Error;
-class Socket;
-class SocketAddress;
-
-class ConnectionFileDescriptor :
- public Connection
-{
-public:
-
- ConnectionFileDescriptor ();
-
- ConnectionFileDescriptor (int fd, bool owns_fd);
-
- virtual
- ~ConnectionFileDescriptor ();
-
- virtual bool
- IsConnected () const;
-
- virtual lldb::ConnectionStatus
- Connect (const char *s, Error *error_ptr);
-
- virtual lldb::ConnectionStatus
- Disconnect (Error *error_ptr);
-
- virtual size_t
- Read (void *dst,
- size_t dst_len,
- uint32_t timeout_usec,
- lldb::ConnectionStatus &status,
- Error *error_ptr);
-
- virtual size_t
- Write (const void *src,
- size_t src_len,
- lldb::ConnectionStatus &status,
- Error *error_ptr);
-
- lldb::ConnectionStatus
- BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
-
- bool
- InterruptRead ();
-
- lldb::IOObjectSP GetReadObject() { return m_read_sp; }
- const lldb::IOObjectSP GetReadObject() const { return m_read_sp; }
-
- uint16_t GetListeningPort(uint32_t timeout_sec);
-
-protected:
-
- void
- OpenCommandPipe ();
-
- void
- CloseCommandPipe ();
-
- lldb::ConnectionStatus
- SocketListen (const char *host_and_port, Error *error_ptr);
-
- lldb::ConnectionStatus
- ConnectTCP (const char *host_and_port, Error *error_ptr);
-
- lldb::ConnectionStatus
- ConnectUDP (const char *args, Error *error_ptr);
-
- lldb::ConnectionStatus
- NamedSocketConnect (const char *socket_name, Error *error_ptr);
-
- lldb::ConnectionStatus
- NamedSocketAccept (const char *socket_name, Error *error_ptr);
-
- lldb::IOObjectSP m_read_sp;
- lldb::IOObjectSP m_write_sp;
-
- Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread
- // that creates the socket, binds and listens to resolve
- // the port number.
-
- Pipe m_pipe;
- Mutex m_mutex;
- std::atomic<bool> m_shutting_down; // This marks that we are shutting down so if we get woken up from
- // BytesAvailable to disconnect, we won't try to read again.
- bool m_waiting_for_accept;
-private:
- DISALLOW_COPY_AND_ASSIGN (ConnectionFileDescriptor);
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_ConnectionFileDescriptor_h_
diff --git a/lldb/include/lldb/Host/ConnectionFileDescriptor.h b/lldb/include/lldb/Host/ConnectionFileDescriptor.h
new file mode 100644
index 00000000000..0d486a34c8d
--- /dev/null
+++ b/lldb/include/lldb/Host/ConnectionFileDescriptor.h
@@ -0,0 +1,15 @@
+//===-- ConnectionFileDescriptor.h ------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_ConnectionFileDescriptor_h_
+#define liblldb_Host_ConnectionFileDescriptor_h_
+
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
+
+#endif
diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index 5cba8465d65..58c091a1754 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -23,8 +23,8 @@
#include <string>
#include <vector>
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Host/Condition.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/Predicate.h"
diff --git a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
new file mode 100644
index 00000000000..31fc4993ae8
--- /dev/null
+++ b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h
@@ -0,0 +1,104 @@
+//===-- ConnectionFileDescriptorPosix.h -------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
+#define liblldb_Host_posix_ConnectionFileDescriptorPosix_h_
+
+// C++ Includes
+#include <atomic>
+#include <memory>
+
+#include "lldb/lldb-forward.h"
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/Connection.h"
+#include "lldb/Host/Mutex.h"
+#include "lldb/Host/Pipe.h"
+#include "lldb/Host/Predicate.h"
+#include "lldb/Host/IOObject.h"
+
+namespace lldb_private
+{
+
+class Error;
+class Socket;
+class SocketAddress;
+
+class ConnectionFileDescriptor : public Connection
+{
+ public:
+ ConnectionFileDescriptor();
+
+ ConnectionFileDescriptor(int fd, bool owns_fd);
+
+ virtual ~ConnectionFileDescriptor();
+
+ virtual bool IsConnected() const;
+
+ virtual lldb::ConnectionStatus Connect(const char *s, Error *error_ptr);
+
+ virtual lldb::ConnectionStatus Disconnect(Error *error_ptr);
+
+ virtual size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr);
+
+ virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
+
+ lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec, Error *error_ptr);
+
+ bool InterruptRead();
+
+ lldb::IOObjectSP
+ GetReadObject()
+ {
+ return m_read_sp;
+ }
+ const lldb::IOObjectSP
+ GetReadObject() const
+ {
+ return m_read_sp;
+ }
+
+ uint16_t GetListeningPort(uint32_t timeout_sec);
+
+ protected:
+ void OpenCommandPipe();
+
+ void CloseCommandPipe();
+
+ lldb::ConnectionStatus SocketListen(const char *host_and_port, Error *error_ptr);
+
+ lldb::ConnectionStatus ConnectTCP(const char *host_and_port, Error *error_ptr);
+
+ lldb::ConnectionStatus ConnectUDP(const char *args, Error *error_ptr);
+
+ lldb::ConnectionStatus NamedSocketConnect(const char *socket_name, Error *error_ptr);
+
+ lldb::ConnectionStatus NamedSocketAccept(const char *socket_name, Error *error_ptr);
+
+ lldb::IOObjectSP m_read_sp;
+ lldb::IOObjectSP m_write_sp;
+
+ Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread
+ // that creates the socket, binds and listens to resolve
+ // the port number.
+
+ Pipe m_pipe;
+ Mutex m_mutex;
+ std::atomic<bool> m_shutting_down; // This marks that we are shutting down so if we get woken up from
+ // BytesAvailable to disconnect, we won't try to read again.
+ bool m_waiting_for_accept;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
+};
+
+} // namespace lldb_private
+
+#endif // liblldb_ConnectionFileDescriptor_h_
diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp
index df0b864fad9..9e0be0ffcc9 100644
--- a/lldb/source/API/SBCommunication.cpp
+++ b/lldb/source/API/SBCommunication.cpp
@@ -10,8 +10,8 @@
#include "lldb/API/SBCommunication.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Log.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index 6cd5418ea6b..9dda779914f 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -11,7 +11,6 @@ add_lldb_library(lldbCore
Broadcaster.cpp
Communication.cpp
Connection.cpp
- ConnectionFileDescriptor.cpp
ConnectionMachPort.cpp
ConnectionSharedMemory.cpp
ConstString.cpp
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 92f40a5e301..5fb60cfd0b6 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -18,7 +18,6 @@
#include "llvm/ADT/StringRef.h"
#include "lldb/lldb-private.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RegisterValue.h"
@@ -34,6 +33,7 @@
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Host/ThreadLauncher.h"
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index 578c9469a06..0540ce765ad 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -33,6 +33,10 @@ add_host_subdirectory(common
common/TimeValue.cpp
)
+add_host_subdirectory(posix
+ posix/ConnectionFileDescriptorPosix.cpp
+ )
+
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
add_host_subdirectory(windows
windows/Condition.cpp
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 184c6f65b53..ffa4f849965 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -39,12 +39,12 @@
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
diff --git a/lldb/source/Core/ConnectionFileDescriptor.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
index 357cd3c54f7..f0513b87700 100644
--- a/lldb/source/Core/ConnectionFileDescriptor.cpp
+++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp
@@ -1,4 +1,4 @@
-//===-- ConnectionFileDescriptor.cpp ----------------------------*- C++ -*-===//
+//===-- ConnectionFileDescriptorPosix.cpp -----------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,7 +14,7 @@
#define _DARWIN_UNLIMITED_SELECT
#endif
-#include "lldb/Core/ConnectionFileDescriptor.h"
+#include "lldb/Host/posix/ConnectionFileDescriptorPosix.h"
#include "lldb/Host/Config.h"
#include "lldb/Host/IOObject.h"
#include "lldb/Host/SocketAddress.h"
@@ -46,99 +46,91 @@
#include "lldb/Host/Socket.h"
#include "lldb/Interpreter/Args.h"
-
using namespace lldb;
using namespace lldb_private;
-ConnectionFileDescriptor::ConnectionFileDescriptor () :
- Connection(),
- m_pipe (),
- m_mutex (Mutex::eMutexTypeRecursive),
- m_shutting_down (false),
- m_waiting_for_accept (false)
+ConnectionFileDescriptor::ConnectionFileDescriptor()
+ : Connection()
+ , m_pipe()
+ , m_mutex(Mutex::eMutexTypeRecursive)
+ , m_shutting_down(false)
+ , m_waiting_for_accept(false)
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor ()", static_cast<void *>(this));
}
-ConnectionFileDescriptor::ConnectionFileDescriptor (int fd, bool owns_fd) :
- Connection(),
- m_pipe (),
- m_mutex (Mutex::eMutexTypeRecursive),
- m_shutting_down (false),
- m_waiting_for_accept (false)
+ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd)
+ : Connection()
+ , m_pipe()
+ , m_mutex(Mutex::eMutexTypeRecursive)
+ , m_shutting_down(false)
+ , m_waiting_for_accept(false)
{
m_write_sp.reset(new File(fd, owns_fd));
m_read_sp.reset(new File(fd, false));
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)",
- static_cast<void*>(this), fd, owns_fd);
- OpenCommandPipe ();
+ log->Printf("%p ConnectionFileDescriptor::ConnectionFileDescriptor (fd = %i, owns_fd = %i)", static_cast<void *>(this), fd,
+ owns_fd);
+ OpenCommandPipe();
}
-
-ConnectionFileDescriptor::~ConnectionFileDescriptor ()
+ConnectionFileDescriptor::~ConnectionFileDescriptor()
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()",
- static_cast<void*>(this));
- Disconnect (NULL);
- CloseCommandPipe ();
+ log->Printf("%p ConnectionFileDescriptor::~ConnectionFileDescriptor ()", static_cast<void *>(this));
+ Disconnect(NULL);
+ CloseCommandPipe();
}
void
-ConnectionFileDescriptor::OpenCommandPipe ()
+ConnectionFileDescriptor::OpenCommandPipe()
{
CloseCommandPipe();
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
// Make the command file descriptor here:
if (!m_pipe.Open())
{
if (log)
- log->Printf ("%p ConnectionFileDescriptor::OpenCommandPipe () - could not make pipe: %s",
- static_cast<void*>(this), strerror(errno));
+ log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe () - could not make pipe: %s", static_cast<void *>(this),
+ strerror(errno));
}
else
{
if (log)
- log->Printf ("%p ConnectionFileDescriptor::OpenCommandPipe() - success readfd=%d writefd=%d",
- static_cast<void*>(this),
- m_pipe.GetReadFileDescriptor(),
- m_pipe.GetWriteFileDescriptor());
+ log->Printf("%p ConnectionFileDescriptor::OpenCommandPipe() - success readfd=%d writefd=%d", static_cast<void *>(this),
+ m_pipe.GetReadFileDescriptor(), m_pipe.GetWriteFileDescriptor());
}
}
void
-ConnectionFileDescriptor::CloseCommandPipe ()
+ConnectionFileDescriptor::CloseCommandPipe()
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::CloseCommandPipe()",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::CloseCommandPipe()", static_cast<void *>(this));
m_pipe.Close();
}
bool
-ConnectionFileDescriptor::IsConnected () const
+ConnectionFileDescriptor::IsConnected() const
{
return (m_read_sp && m_read_sp->IsValid()) || (m_write_sp && m_write_sp->IsValid());
}
ConnectionStatus
-ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
+ConnectionFileDescriptor::Connect(const char *s, Error *error_ptr)
{
- Mutex::Locker locker (m_mutex);
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Mutex::Locker locker(m_mutex);
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')",
- static_cast<void*>(this), s);
+ log->Printf("%p ConnectionFileDescriptor::Connect (url = '%s')", static_cast<void *>(this), s);
OpenCommandPipe();
@@ -147,51 +139,51 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
if (strstr(s, "listen://") == s)
{
// listen://HOST:PORT
- return SocketListen (s + strlen("listen://"), error_ptr);
+ return SocketListen(s + strlen("listen://"), error_ptr);
}
else if (strstr(s, "accept://") == s)
{
// unix://SOCKNAME
- return NamedSocketAccept (s + strlen("accept://"), error_ptr);
+ return NamedSocketAccept(s + strlen("accept://"), error_ptr);
}
else if (strstr(s, "unix-accept://") == s)
{
// unix://SOCKNAME
- return NamedSocketAccept (s + strlen("unix-accept://"), error_ptr);
+ return NamedSocketAccept(s + strlen("unix-accept://"), error_ptr);
}
else if (strstr(s, "connect://") == s)
{
- return ConnectTCP (s + strlen("connect://"), error_ptr);
+ return ConnectTCP(s + strlen("connect://"), error_ptr);
}
else if (strstr(s, "tcp-connect://") == s)
{
- return ConnectTCP (s + strlen("tcp-connect://"), error_ptr);
+ return ConnectTCP(s + strlen("tcp-connect://"), error_ptr);
}
else if (strstr(s, "udp://") == s)
{
- return ConnectUDP (s + strlen("udp://"), error_ptr);
+ return ConnectUDP(s + strlen("udp://"), error_ptr);
}
#ifndef LLDB_DISABLE_POSIX
else if (strstr(s, "fd://") == s)
{
// Just passing a native file descriptor within this current process
// that is already opened (possibly from a service or other source).
- s += strlen ("fd://");
+ s += strlen("fd://");
bool success = false;
- int fd = Args::StringToSInt32 (s, -1, 0, &success);
+ int fd = Args::StringToSInt32(s, -1, 0, &success);
if (success)
{
- // We have what looks to be a valid file descriptor, but we
+ // We have what looks to be a valid file descriptor, but we
// should make sure it is. We currently are doing this by trying to
- // get the flags from the file descriptor and making sure it
+ // get the flags from the file descriptor and making sure it
// isn't a bad fd.
errno = 0;
- int flags = ::fcntl (fd, F_GETFL, 0);
+ int flags = ::fcntl(fd, F_GETFL, 0);
if (flags == -1 || errno == EBADF)
{
if (error_ptr)
- error_ptr->SetErrorStringWithFormat ("stale file descriptor: %s", s);
+ error_ptr->SetErrorStringWithFormat("stale file descriptor: %s", s);
m_read_sp.reset();
m_write_sp.reset();
return eConnectionStatusError;
@@ -200,17 +192,17 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
{
// Don't take ownership of a file descriptor that gets passed
// to us since someone else opened the file descriptor and
- // handed it to us.
- // TODO: Since are using a URL to open connection we should
+ // handed it to us.
+ // TODO: Since are using a URL to open connection we should
// eventually parse options using the web standard where we
// have "fd://123?opt1=value;opt2=value" and we can have an
// option be "owns=1" or "owns=0" or something like this to
- // allow us to specify this. For now, we assume we must
+ // allow us to specify this. For now, we assume we must
// assume we don't own it.
std::unique_ptr<Socket> tcp_socket;
tcp_socket.reset(new Socket(fd, Socket::ProtocolTcp, false));
- // Try and get a socket option from this file descriptor to
+ // Try and get a socket option from this file descriptor to
// see if this is a socket and set m_is_socket accordingly.
int resuse;
bool is_socket = !!tcp_socket->GetOption(SOL_SOCKET, SO_REUSEADDR, resuse);
@@ -229,7 +221,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
}
if (error_ptr)
- error_ptr->SetErrorStringWithFormat ("invalid file descriptor: \"fd://%s\"", s);
+ error_ptr->SetErrorStringWithFormat("invalid file descriptor: \"fd://%s\"", s);
m_read_sp.reset();
m_write_sp.reset();
return eConnectionStatusError;
@@ -241,7 +233,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
int fd = -1;
do
{
- fd = ::open (path, O_RDWR);
+ fd = ::open(path, O_RDWR);
} while (fd == -1 && errno == EINTR);
if (fd == -1)
@@ -255,29 +247,29 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
{
// Set up serial terminal emulation
struct termios options;
- ::tcgetattr (fd, &options);
+ ::tcgetattr(fd, &options);
// Set port speed to maximum
- ::cfsetospeed (&options, B115200);
- ::cfsetispeed (&options, B115200);
+ ::cfsetospeed(&options, B115200);
+ ::cfsetispeed(&options, B115200);
// Raw input, disable echo and signals
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
// Make sure only one character is needed to return from a read
- options.c_cc[VMIN] = 1;
+ options.c_cc[VMIN] = 1;
options.c_cc[VTIME] = 0;
- ::tcsetattr (fd, TCSANOW, &options);
+ ::tcsetattr(fd, TCSANOW, &options);
}
- int flags = ::fcntl (fd, F_GETFL, 0);
+ int flags = ::fcntl(fd, F_GETFL, 0);
if (flags >= 0)
{
if ((flags & O_NONBLOCK) == 0)
{
flags |= O_NONBLOCK;
- ::fcntl (fd, F_SETFL, flags);
+ ::fcntl(fd, F_SETFL, flags);
}
}
m_read_sp.reset(new File(fd, true));
@@ -286,7 +278,7 @@ ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
}
#endif
if (error_ptr)
- error_ptr->SetErrorStringWithFormat ("unsupported connection URL: '%s'", s);
+ error_ptr->SetErrorStringWithFormat("unsupported connection URL: '%s'", s);
return eConnectionStatusError;
}
if (error_ptr)
@@ -301,25 +293,23 @@ ConnectionFileDescriptor::InterruptRead()
}
ConnectionStatus
-ConnectionFileDescriptor::Disconnect (Error *error_ptr)
+ConnectionFileDescriptor::Disconnect(Error *error_ptr)
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Disconnect ()",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::Disconnect ()", static_cast<void *>(this));
ConnectionStatus status = eConnectionStatusSuccess;
if (!IsConnected())
{
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::Disconnect(): Nothing to disconnect", static_cast<void *>(this));
return eConnectionStatusSuccess;
}
if (m_read_sp && m_read_sp->IsValid() && m_read_sp->GetFdType() == IOObject::eFDTypeSocket)
- static_cast<Socket&>(*m_read_sp).PreDisconnect();
+ static_cast<Socket &>(*m_read_sp).PreDisconnect();
// Try to get the ConnectionFileDescriptor's mutex. If we fail, that is quite likely
// because somebody is doing a blocking read on our file descriptor. If that's the case,
@@ -329,7 +319,7 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr)
m_shutting_down = true;
Mutex::Locker locker;
- bool got_lock = locker.TryLock (m_mutex);
+ bool got_lock = locker.TryLock(m_mutex);
if (!got_lock)
{
@@ -338,15 +328,15 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr)
int result;
result = m_pipe.Write("q", 1) == 1;
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, sent 'q' to %d, result = %d.",
- static_cast<void*>(this), m_pipe.GetWriteFileDescriptor(), result);
+ log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, sent 'q' to %d, result = %d.",
+ static_cast<void *>(this), m_pipe.GetWriteFileDescriptor(), result);
}
else if (log)
{
- log->Printf ("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::Disconnect(): Couldn't get the lock, but no command pipe is available.",
+ static_cast<void *>(this));
}
- locker.Lock (m_mutex);
+ locker.Lock(m_mutex);
}
Error error = m_read_sp->Close();
@@ -361,23 +351,18 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr)
}
size_t
-ConnectionFileDescriptor::Read (void *dst,
- size_t dst_len,
- uint32_t timeout_usec,
- ConnectionStatus &status,
- Error *error_ptr)
+ConnectionFileDescriptor::Read(void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status, Error *error_ptr)
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
Mutex::Locker locker;
- bool got_lock = locker.TryLock (m_mutex);
+ bool got_lock = locker.TryLock(m_mutex);
if (!got_lock)
{
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Read () failed to get the connection lock.",
- static_cast<void*>(this));
+ log->Printf("%p ConnectionFileDescriptor::Read () failed to get the connection lock.", static_cast<void *>(this));
if (error_ptr)
- error_ptr->SetErrorString ("failed to get the connection lock for read.");
+ error_ptr->SetErrorString("failed to get the connection lock for read.");
status = eConnectionStatusTimedOut;
return 0;
@@ -385,7 +370,7 @@ ConnectionFileDescriptor::Read (void *dst,
else if (m_shutting_down)
return eConnectionStatusError;
- status = BytesAvailable (timeout_usec, error_ptr);
+ status = BytesAvailable(timeout_usec, error_ptr);
if (status != eConnectionStatusSuccess)
return 0;
@@ -396,12 +381,8 @@ ConnectionFileDescriptor::Read (void *dst,
if (log)
{
log->Printf("%p ConnectionFileDescriptor::Read() fd = %" PRIu64 ", dst = %p, dst_len = %" PRIu64 ") => %" PRIu64 ", error = %s",
- static_cast<void*>(this),
- static_cast<uint64_t>(m_read_sp->GetWaitableHandle()),
- static_cast<void*>(dst),
- static_cast<uint64_t>(dst_len),
- static_cast<uint64_t>(bytes_read),
- error.AsCString());
+ static_cast<void *>(this), static_cast<uint64_t>(m_read_sp->GetWaitableHandle()), static_cast<void *>(dst),
+ static_cast<uint64_t>(dst_len), static_cast<uint64_t>(bytes_read), error.AsCString());
}
if (bytes_read == 0)
@@ -418,49 +399,48 @@ ConnectionFileDescriptor::Read (void *dst,
uint32_t error_value = error.GetError();
switch (error_value)
{
- case EAGAIN: // The file was marked for non-blocking I/O, and no data were ready to be read.
- if (m_read_sp->GetFdType() == IOObject::eFDTypeSocket)
+ case EAGAIN: // The file was marked for non-blocking I/O, and no data were ready to be read.
+ if (m_read_sp->GetFdType() == IOObject::eFDTypeSocket)
+ status = eConnectionStatusTimedOut;
+ else
+ status = eConnectionStatusSuccess;
+ return 0;
+
+ case EFAULT: // Buf points outside the allocated address space.
+ case EINTR: // A read from a slow device was interrupted before any data arrived by the delivery of a signal.
+ case EINVAL: // The pointer associated with fildes was negative.
+ case EIO: // An I/O error occurred while reading from the file system.
+ // The process group is orphaned.
+ // The file is a regular file, nbyte is greater than 0,
+ // the starting position is before the end-of-file, and
+ // the starting position is greater than or equal to the
+ // offset maximum established for the open file
+ // descriptor associated with fildes.
+ case EISDIR: // An attempt is made to read a directory.
+ case ENOBUFS: // An attempt to allocate a memory buffer fails.
+ case ENOMEM: // Insufficient memory is available.
+ status = eConnectionStatusError;
+ break; // Break to close....
+
+ case ENOENT: // no such file or directory
+ case EBADF: // fildes is not a valid file or socket descriptor open for reading.
+ case ENXIO: // An action is requested of a device that does not exist..
+ // A requested action cannot be performed by the device.
+ case ECONNRESET: // The connection is closed by the peer during a read attempt on a socket.
+ case ENOTCONN: // A read is attempted on an unconnected socket.
+ status = eConnectionStatusLostConnection;
+ break; // Break to close....
+
+ case ETIMEDOUT: // A transmission timeout occurs during a read attempt on a socket.
status = eConnectionStatusTimedOut;
- else
- status = eConnectionStatusSuccess;
- return 0;
-
- case EFAULT: // Buf points outside the allocated address space.
- case EINTR: // A read from a slow device was interrupted before any data arrived by the delivery of a signal.
- case EINVAL: // The pointer associated with fildes was negative.
- case EIO: // An I/O error occurred while reading from the file system.
- // The process group is orphaned.
- // The file is a regular file, nbyte is greater than 0,
- // the starting position is before the end-of-file, and
- // the starting position is greater than or equal to the
- // offset maximum established for the open file
- // descriptor associated with fildes.
- case EISDIR: // An attempt is made to read a directory.
- case ENOBUFS: // An attempt to allocate a memory buffer fails.
- case ENOMEM: // Insufficient memory is available.
- status = eConnectionStatusError;
- break; // Break to close....
-
- case ENOENT: // no such file or directory
- case EBADF: // fildes is not a valid file or socket descriptor open for reading.
- case ENXIO: // An action is requested of a device that does not exist..
- // A requested action cannot be performed by the device.
- case ECONNRESET:// The connection is closed by the peer during a read attempt on a socket.
- case ENOTCONN: // A read is attempted on an unconnected socket.
- status = eConnectionStatusLostConnection;
- break; // Break to close....
-
- case ETIMEDOUT: // A transmission timeout occurs during a read attempt on a socket.
- status = eConnectionStatusTimedOut;
- return 0;
-
- default:
- if (log)
- log->Printf("%p ConnectionFileDescriptor::Read (), unexpected error: %s",
- static_cast<void*>(this), strerror(error_value));
- status = eConnectionStatusError;
- break; // Break to close....
-
+ return 0;
+
+ default:
+ if (log)
+ log->Printf("%p ConnectionFileDescriptor::Read (), unexpected error: %s", static_cast<void *>(this),
+ strerror(error_value));
+ status = eConnectionStatusError;
+ break; // Break to close....
}
return 0;
@@ -469,15 +449,14 @@ ConnectionFileDescriptor::Read (void *dst,
}
size_t
-ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStatus &status, Error *error_ptr)
+ConnectionFileDescriptor::Write(const void *src, size_t src_len, ConnectionStatus &status, Error *error_ptr)
{
- Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")",
- static_cast<void*>(this), static_cast<const void*>(src),
- static_cast<uint64_t>(src_len));
+ log->Printf("%p ConnectionFileDescriptor::Write (src = %p, src_len = %" PRIu64 ")", static_cast<void *>(this),
+ static_cast<const void *>(src), static_cast<uint64_t>(src_len));
- if (!IsConnected ())
+ if (!IsConnected())
{
if (error_ptr)
error_ptr->SetErrorString("not connected");
@@ -485,7 +464,6 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
return 0;
}
-
Error error;
size_t bytes_sent = src_len;
@@ -493,13 +471,9 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
if (log)
{
- log->Printf ("%p ConnectionFileDescriptor::Write(fd = %" PRIu64 ", src = %p, src_len = %" PRIu64 ") => %" PRIu64 " (error = %s)",
- static_cast<void*>(this),
- static_cast<uint64_t>(m_write_sp->GetWaitableHandle()),
- static_cast<const void*>(src),
- static_cast<uint64_t>(src_len),
- static_cast<uint64_t>(bytes_sent),
- error.AsCString());
+ log->Printf("%p ConnectionFileDescriptor::Write(fd = %" PRIu64 ", src = %p, src_len = %" PRIu64 ") => %" PRIu64 " (error = %s)",
+ static_cast<void *>(this), static_cast<uint64_t>(m_write_sp->GetWaitableHandle()), static_cast<const void *>(src),
+ static_cast<uint64_t>(src_len), static_cast<uint64_t>(bytes_sent), error.AsCString());
}
if (error_ptr)
@@ -509,19 +483,19 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
{
switch (error.GetError())
{
- case EAGAIN:
- case EINTR:
- status = eConnectionStatusSuccess;
- return 0;
-
- case ECONNRESET:// The connection is closed by the peer during a read attempt on a socket.
- case ENOTCONN: // A read is attempted on an unconnected socket.
- status = eConnectionStatusLostConnection;
- break; // Break to close....
-
- default:
- status = eConnectionStatusError;
- break; // Break to close....
+ case EAGAIN:
+ case EINTR:
+ status = eConnectionStatusSuccess;
+ return 0;
+
+ case ECONNRESET: // The connection is closed by the peer during a read attempt on a socket.
+ case ENOTCONN: // A read is attempted on an unconnected socket.
+ status = eConnectionStatusLostConnection;
+ break; // Break to close....
+
+ default:
+ status = eConnectionStatusError;
+ break; // Break to close....
}
return 0;
@@ -531,8 +505,6 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
return bytes_sent;
}
-
-
// This ConnectionFileDescriptor::BytesAvailable() uses select().
//
// PROS:
@@ -554,15 +526,14 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
#endif
ConnectionStatus
-ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_ptr)
+ConnectionFileDescriptor::BytesAvailable(uint32_t timeout_usec, Error *error_ptr)
{
// Don't need to take the mutex here separately since we are only called from Read. If we
// ever get used more generally we will need to lock here as well.
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_CONNECTION));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_CONNECTION));
if (log)
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)",
- static_cast<void*>(this), timeout_usec);
+ log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", static_cast<void *>(this), timeout_usec);
struct timeval *tv_ptr;
struct timeval tv;
@@ -574,7 +545,7 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
else
{
TimeValue time_value;
- time_value.OffsetWithMicroSeconds (timeout_usec);
+ time_value.OffsetWithMicroSeconds(timeout_usec);
tv.tv_sec = time_value.seconds();
tv.tv_usec = time_value.microseconds();
tv_ptr = &tv;
@@ -596,9 +567,9 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
#else
const bool have_pipe_fd = pipe_fd >= 0;
#if !defined(__APPLE__)
- assert (handle < FD_SETSIZE);
+ assert(handle < FD_SETSIZE);
if (have_pipe_fd)
- assert (pipe_fd < FD_SETSIZE);
+ assert(pipe_fd < FD_SETSIZE);
#endif
#endif
while (handle == m_read_sp->GetWaitableHandle())
@@ -606,35 +577,34 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
const int nfds = std::max<int>(handle, pipe_fd) + 1;
#if defined(__APPLE__)
llvm::SmallVector<fd_set, 1> read_fds;
- read_fds.resize((nfds/FD_SETSIZE) + 1);
- for (size_t i=0; i<read_fds.size(); ++i)
- FD_ZERO (&read_fds[i]);
- // FD_SET doesn't bounds check, it just happily walks off the end
- // but we have taken care of making the extra storage with our
- // SmallVector of fd_set objects
+ read_fds.resize((nfds / FD_SETSIZE) + 1);
+ for (size_t i = 0; i < read_fds.size(); ++i)
+ FD_ZERO(&read_fds[i]);
+// FD_SET doesn't bounds check, it just happily walks off the end
+// but we have taken care of making the extra storage with our
+// SmallVector of fd_set objects
#else
fd_set read_fds;
- FD_ZERO (&read_fds);
+ FD_ZERO(&read_fds);
#endif
- FD_SET (handle, FD_SET_DATA(read_fds));
+ FD_SET(handle, FD_SET_DATA(read_fds));
if (have_pipe_fd)
- FD_SET (pipe_fd, FD_SET_DATA(read_fds));
+ FD_SET(pipe_fd, FD_SET_DATA(read_fds));
Error error;
if (log)
{
if (have_pipe_fd)
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p)...",
- static_cast<void*>(this), nfds, handle, pipe_fd,
- static_cast<void*>(tv_ptr));
+ log->Printf(
+ "%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p)...",
+ static_cast<void *>(this), nfds, handle, pipe_fd, static_cast<void *>(tv_ptr));
else
log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p)...",
- static_cast<void*>(this), nfds, handle,
- static_cast<void*>(tv_ptr));
+ static_cast<void *>(this), nfds, handle, static_cast<void *>(tv_ptr));
}
- const int num_set_fds = ::select (nfds, FD_SET_DATA(read_fds), NULL, NULL, tv_ptr);
+ const int num_set_fds = ::select(nfds, FD_SET_DATA(read_fds), NULL, NULL, tv_ptr);
if (num_set_fds < 0)
error.SetErrorToErrno();
else
@@ -643,15 +613,14 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
if (log)
{
if (have_pipe_fd)
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p) => %d, error = %s",
- static_cast<void*>(this), nfds, handle,
- pipe_fd, static_cast<void*>(tv_ptr), num_set_fds,
+ log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i, %i}, NULL, NULL, timeout=%p) "
+ "=> %d, error = %s",
+ static_cast<void *>(this), nfds, handle, pipe_fd, static_cast<void *>(tv_ptr), num_set_fds,
error.AsCString());
else
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p) => %d, error = %s",
- static_cast<void*>(this), nfds, handle,
- static_cast<void*>(tv_ptr), num_set_fds,
- error.AsCString());
+ log->Printf("%p ConnectionFileDescriptor::BytesAvailable() ::select (nfds=%i, fds={%i}, NULL, NULL, timeout=%p) => "
+ "%d, error = %s",
+ static_cast<void *>(this), nfds, handle, static_cast<void *>(tv_ptr), num_set_fds, error.AsCString());
}
if (error_ptr)
@@ -661,20 +630,20 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
{
switch (error.GetError())
{
- case EBADF: // One of the descriptor sets specified an invalid descriptor.
+ case EBADF: // One of the descriptor sets specified an invalid descriptor.
return eConnectionStatusLostConnection;
- case EINVAL: // The specified time limit is invalid. One of its components is negative or too large.
- default: // Other unknown error
+ case EINVAL: // The specified time limit is invalid. One of its components is negative or too large.
+ default: // Other unknown error
return eConnectionStatusError;
- case EAGAIN: // The kernel was (perhaps temporarily) unable to
- // allocate the requested number of file descriptors,
- // or we have non-blocking IO
- case EINTR: // A signal was delivered before the time limit
+ case EAGAIN: // The kernel was (perhaps temporarily) unable to
+ // allocate the requested number of file descriptors,
+ // or we have non-blocking IO
+ case EINTR: // A signal was delivered before the time limit
// expired and before any of the selected events
// occurred.
- break; // Lets keep reading to until we timeout
+ break; // Lets keep reading to until we timeout
}
}
else if (num_set_fds == 0)
@@ -693,20 +662,19 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
do
{
- bytes_read = ::read (pipe_fd, buffer, sizeof(buffer));
+ bytes_read = ::read(pipe_fd, buffer, sizeof(buffer));
} while (bytes_read < 0 && errno == EINTR);
-
+
switch (buffer[0])
{
- case 'q':
- if (log)
- log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.",
- static_cast<void*>(this),
- static_cast<int>(bytes_read), buffer);
- return eConnectionStatusEndOfFile;
- case 'i':
- // Interrupt the current read
- return eConnectionStatusInterrupted;
+ case 'q':
+ if (log)
+ log->Printf("%p ConnectionFileDescriptor::BytesAvailable() got data: %*s from the command channel.",
+ static_cast<void *>(this), static_cast<int>(bytes_read), buffer);
+ return eConnectionStatusEndOfFile;
+ case 'i':
+ // Interrupt the current read
+ return eConnectionStatusInterrupted;
}
}
}
@@ -719,9 +687,9 @@ ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_pt
}
ConnectionStatus
-ConnectionFileDescriptor::NamedSocketAccept (const char *socket_name, Error *error_ptr)
+ConnectionFileDescriptor::NamedSocketAccept(const char *socket_name, Error *error_ptr)
{
- Socket* socket = nullptr;
+ Socket *socket = nullptr;
Error error = Socket::UnixDomainAccept(socket_name, socket);
if (error_ptr)
*error_ptr = error;
@@ -731,9 +699,9 @@ ConnectionFileDescriptor::NamedSocketAccept (const char *socket_name, Error *err
}
ConnectionStatus
-ConnectionFileDescriptor::NamedSocketConnect (const char *socket_name, Error *error_ptr)
+ConnectionFileDescriptor::NamedSocketConnect(const char *socket_name, Error *error_ptr)
{
- Socket* socket = nullptr;
+ Socket *socket = nullptr;
Error error = Socket::UnixDomainConnect(socket_name, socket);
if (error_ptr)
*error_ptr = error;
@@ -747,7 +715,7 @@ ConnectionFileDescriptor::SocketListen(const char *s, Error *error_ptr)
{
m_port_predicate.SetValue(0, eBroadcastNever);
- Socket* socket = nullptr;
+ Socket *socket = nullptr;
m_waiting_for_accept = true;
Error error = Socket::TcpListen(s, socket, &m_port_predicate);
if (error_ptr)
@@ -774,7 +742,7 @@ ConnectionFileDescriptor::SocketListen(const char *s, Error *error_ptr)
ConnectionStatus
ConnectionFileDescriptor::ConnectTCP(const char *s, Error *error_ptr)
{
- Socket* socket = nullptr;
+ Socket *socket = nullptr;
Error error = Socket::TcpConnect(s, socket);
if (error_ptr)
*error_ptr = error;
@@ -786,8 +754,8 @@ ConnectionFileDescriptor::ConnectTCP(const char *s, Error *error_ptr)
ConnectionStatus
ConnectionFileDescriptor::ConnectUDP(const char *s, Error *error_ptr)
{
- Socket* send_socket = nullptr;
- Socket* recv_socket = nullptr;
+ Socket *send_socket = nullptr;
+ Socket *recv_socket = nullptr;
Error error = Socket::UdpConnect(s, send_socket, recv_socket);
if (error_ptr)
*error_ptr = error;
@@ -796,17 +764,17 @@ ConnectionFileDescriptor::ConnectUDP(const char *s, Error *error_ptr)
return (error.Success()) ? eConnectionStatusSuccess : eConnectionStatusError;
}
-
-uint16_t ConnectionFileDescriptor::GetListeningPort(uint32_t timeout_sec)
+uint16_t
+ConnectionFileDescriptor::GetListeningPort(uint32_t timeout_sec)
{
uint16_t bound_port = 0;
if (timeout_sec == UINT32_MAX)
- m_port_predicate.WaitForValueNotEqualTo (0, bound_port);
+ m_port_predicate.WaitForValueNotEqualTo(0, bound_port);
else
{
TimeValue timeout = TimeValue::Now();
timeout.OffsetWithSeconds(timeout_sec);
- m_port_predicate.WaitForValueNotEqualTo (0, bound_port, &timeout);
+ m_port_predicate.WaitForValueNotEqualTo(0, bound_port, &timeout);
}
return bound_port;
}
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index 42a7640f348..03b39d19de0 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -28,9 +28,9 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Core/Communication.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Timer.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Interpreter/CommandInterpreter.h"
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index a2f6f43c586..66c321a2520 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -16,7 +16,6 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
@@ -24,6 +23,7 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Host.h"
#include "lldb/Target/Process.h"
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 668d1b25569..584a62ce963 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -13,13 +13,13 @@
// C++ Includes
// Other libraries and framework includes
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/State.h"
#include "lldb/Core/UUID.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Host/Socket.h"
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index eea7655fd09..805e9421a1b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -17,10 +17,10 @@
// C++ Includes
// Other libraries and framework includes
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/Host.h"
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 66cf8f55bb0..fa8fdea706f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -20,11 +20,11 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamGDBRemote.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index 7217cd5f897..5ecf3cc476b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
@@ -23,11 +23,11 @@
// Other libraries and framework includes
#include "llvm/ADT/Triple.h"
#include "lldb/Interpreter/Args.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Debug.h"
#include "lldb/Host/Endian.h"
#include "lldb/Host/File.h"
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 03c0a1d99a8..d2dc2465e8d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -31,7 +31,7 @@
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index fef54bcbe57..4845b45afb8 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -16,21 +16,21 @@
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Event.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
-#include "lldb/Symbol/Symbol.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Expression/ClangUserExpression.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Host/Pipe.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Host/ThreadLauncher.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ABI.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/JITLoader.h"
diff --git a/lldb/tools/lldb-gdbserver/lldb-gdbserver.cpp b/lldb/tools/lldb-gdbserver/lldb-gdbserver.cpp
index b0720b6857b..a0486328d47 100644
--- a/lldb/tools/lldb-gdbserver/lldb-gdbserver.cpp
+++ b/lldb/tools/lldb-gdbserver/lldb-gdbserver.cpp
@@ -25,11 +25,11 @@
// Other libraries and framework includes
#include "lldb/lldb-private-log.h"
#include "lldb/Core/Error.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/ConnectionMachPort.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Host/Socket.h"
diff --git a/lldb/tools/lldb-platform/lldb-platform.cpp b/lldb/tools/lldb-platform/lldb-platform.cpp
index 0ab292aa4af..5c8057d3c29 100644
--- a/lldb/tools/lldb-platform/lldb-platform.cpp
+++ b/lldb/tools/lldb-platform/lldb-platform.cpp
@@ -25,10 +25,10 @@
// Other libraries and framework includes
#include "lldb/lldb-private-log.h"
#include "lldb/Core/Error.h"
-#include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/ConnectionMachPort.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Host/ConnectionFileDescriptor.h"
#include "lldb/Host/HostGetOpt.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
OpenPOWER on IntegriCloud