summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/Socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/common/Socket.cpp')
-rw-r--r--lldb/source/Host/common/Socket.cpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp
index a89f1178e96..ea1049dad81 100644
--- a/lldb/source/Host/common/Socket.cpp
+++ b/lldb/source/Host/common/Socket.cpp
@@ -149,9 +149,8 @@ std::unique_ptr<Socket> Socket::Create(const SocketProtocol protocol,
Status Socket::TcpConnect(llvm::StringRef host_and_port,
bool child_processes_inherit, Socket *&socket) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
- if (log)
- log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
- host_and_port.str().c_str());
+ LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
+ host_and_port.str().c_str());
Status error;
std::unique_ptr<Socket> connect_socket(
@@ -170,8 +169,7 @@ Status Socket::TcpListen(llvm::StringRef host_and_port,
bool child_processes_inherit, Socket *&socket,
Predicate<uint16_t> *predicate, int backlog) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
- if (log)
- log->Printf("Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
+ LLDB_LOGF(log, "Socket::%s (%s)", __FUNCTION__, host_and_port.str().c_str());
Status error;
std::string host_str;
@@ -209,9 +207,8 @@ Status Socket::TcpListen(llvm::StringRef host_and_port,
Status Socket::UdpConnect(llvm::StringRef host_and_port,
bool child_processes_inherit, Socket *&socket) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
- if (log)
- log->Printf("Socket::%s (host/port = %s)", __FUNCTION__,
- host_and_port.str().c_str());
+ LLDB_LOGF(log, "Socket::%s (host/port = %s)", __FUNCTION__,
+ host_and_port.str().c_str());
return UDPSocket::Connect(host_and_port, child_processes_inherit, socket);
}
@@ -345,12 +342,13 @@ Status Socket::Read(void *buf, size_t &num_bytes) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
if (log) {
- log->Printf("%p Socket::Read() (socket = %" PRIu64
- ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
- " (error = %s)",
- static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
- static_cast<uint64_t>(num_bytes),
- static_cast<int64_t>(bytes_received), error.AsCString());
+ LLDB_LOGF(log,
+ "%p Socket::Read() (socket = %" PRIu64
+ ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
+ " (error = %s)",
+ static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
+ static_cast<uint64_t>(num_bytes),
+ static_cast<int64_t>(bytes_received), error.AsCString());
}
return error;
@@ -371,12 +369,13 @@ Status Socket::Write(const void *buf, size_t &num_bytes) {
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION));
if (log) {
- log->Printf("%p Socket::Write() (socket = %" PRIu64
- ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
- " (error = %s)",
- static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
- static_cast<uint64_t>(num_bytes),
- static_cast<int64_t>(bytes_sent), error.AsCString());
+ LLDB_LOGF(log,
+ "%p Socket::Write() (socket = %" PRIu64
+ ", src = %p, src_len = %" PRIu64 ", flags = 0) => %" PRIi64
+ " (error = %s)",
+ static_cast<void *>(this), static_cast<uint64_t>(m_socket), buf,
+ static_cast<uint64_t>(num_bytes),
+ static_cast<int64_t>(bytes_sent), error.AsCString());
}
return error;
@@ -393,9 +392,8 @@ Status Socket::Close() {
return error;
Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION));
- if (log)
- log->Printf("%p Socket::Close (fd = %" PRIu64 ")",
- static_cast<void *>(this), static_cast<uint64_t>(m_socket));
+ LLDB_LOGF(log, "%p Socket::Close (fd = %" PRIu64 ")",
+ static_cast<void *>(this), static_cast<uint64_t>(m_socket));
#if defined(_WIN32)
bool success = !!closesocket(m_socket);
OpenPOWER on IntegriCloud