diff options
Diffstat (limited to 'lldb/source/Host/common')
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 39 | ||||
-rw-r--r-- | lldb/source/Host/common/HostInfoBase.cpp | 21 | ||||
-rw-r--r-- | lldb/source/Host/common/HostNativeThreadBase.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Host/common/NativeProcessProtocol.cpp | 19 | ||||
-rw-r--r-- | lldb/source/Host/common/NativeRegisterContext.cpp | 32 | ||||
-rw-r--r-- | lldb/source/Host/common/Socket.cpp | 44 | ||||
-rw-r--r-- | lldb/source/Host/common/TCPSocket.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Host/common/UDPSocket.cpp | 3 |
8 files changed, 78 insertions, 89 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 3ba9ab7f21f..8e210c7e5fa 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -164,8 +164,7 @@ static bool CheckForMonitorCancellation() { static thread_result_t MonitorChildProcessThreadFunction(void *arg) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); const char *function = __FUNCTION__; - if (log) - log->Printf("%s (arg = %p) thread starting...", function, arg); + LLDB_LOGF(log, "%s (arg = %p) thread starting...", function, arg); MonitorInfo *info = (MonitorInfo *)arg; @@ -193,9 +192,8 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { while (1) { log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); - if (log) - log->Printf("%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", - function, pid, options); + LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", + function, pid, options); if (CheckForMonitorCancellation()) break; @@ -245,12 +243,12 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { #endif log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); - if (log) - log->Printf("%s ::waitpid (pid = %" PRIi32 - ", &status, options = %i) => pid = %" PRIi32 - ", status = 0x%8.8x (%s), signal = %i, exit_state = %i", - function, pid, options, wait_pid, status, status_cstr, - signal, exit_status); + LLDB_LOGF(log, + "%s ::waitpid (pid = %" PRIi32 + ", &status, options = %i) => pid = %" PRIi32 + ", status = 0x%8.8x (%s), signal = %i, exit_state = %i", + function, pid, options, wait_pid, status, status_cstr, signal, + exit_status); if (exited || (signal != 0 && monitor_signals)) { bool callback_return = false; @@ -259,18 +257,18 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { // If our process exited, then this thread should exit if (exited && wait_pid == abs(pid)) { - if (log) - log->Printf("%s (arg = %p) thread exiting because pid received " - "exit signal...", - __FUNCTION__, arg); + LLDB_LOGF(log, + "%s (arg = %p) thread exiting because pid received " + "exit signal...", + __FUNCTION__, arg); break; } // If the callback returns true, it means this process should exit if (callback_return) { - if (log) - log->Printf("%s (arg = %p) thread exiting because callback " - "returned true...", - __FUNCTION__, arg); + LLDB_LOGF(log, + "%s (arg = %p) thread exiting because callback " + "returned true...", + __FUNCTION__, arg); break; } } @@ -279,8 +277,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { } log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); - if (log) - log->Printf("%s (arg = %p) thread exiting...", __FUNCTION__, arg); + LLDB_LOGF(log, "%s (arg = %p) thread exiting...", __FUNCTION__, arg); return nullptr; } diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp index 130f0eb8ac8..3765f36fc79 100644 --- a/lldb/source/Host/common/HostInfoBase.cpp +++ b/lldb/source/Host/common/HostInfoBase.cpp @@ -221,25 +221,24 @@ bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec, return false; std::string raw_path = lldb_file_spec.GetPath(); - if (log) - log->Printf("HostInfo::%s() attempting to " - "derive the path %s relative to liblldb install path: %s", - __FUNCTION__, dir.data(), raw_path.c_str()); + LLDB_LOGF(log, + "HostInfo::%s() attempting to " + "derive the path %s relative to liblldb install path: %s", + __FUNCTION__, dir.data(), raw_path.c_str()); // Drop bin (windows) or lib llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path); if (parent_path.empty()) { - if (log) - log->Printf("HostInfo::%s() failed to find liblldb within the shared " - "lib path", - __FUNCTION__); + LLDB_LOGF(log, + "HostInfo::%s() failed to find liblldb within the shared " + "lib path", + __FUNCTION__); return false; } raw_path = (parent_path + dir).str(); - if (log) - log->Printf("HostInfo::%s() derived the path as: %s", __FUNCTION__, - raw_path.c_str()); + LLDB_LOGF(log, "HostInfo::%s() derived the path as: %s", __FUNCTION__, + raw_path.c_str()); file_spec.GetDirectory().SetString(raw_path); return (bool)file_spec.GetDirectory(); } diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp index a5f876a7232..fe7d85acaf1 100644 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -62,8 +62,7 @@ HostNativeThreadBase::ThreadCreateTrampoline(lldb::thread_arg_t arg) { thread_arg_t thread_arg = info->thread_arg; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_THREAD)); - if (log) - log->Printf("thread created"); + LLDB_LOGF(log, "thread created"); delete info; return thread_fptr(thread_arg); diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index 476ab97a490..8d37c85f394 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -331,22 +331,23 @@ void NativeProcessProtocol::SynchronouslyNotifyProcessStateChanged( if (log) { if (!m_delegates.empty()) { - log->Printf("NativeProcessProtocol::%s: sent state notification [%s] " - "from process %" PRIu64, - __FUNCTION__, lldb_private::StateAsCString(state), GetID()); + LLDB_LOGF(log, + "NativeProcessProtocol::%s: sent state notification [%s] " + "from process %" PRIu64, + __FUNCTION__, lldb_private::StateAsCString(state), GetID()); } else { - log->Printf("NativeProcessProtocol::%s: would send state notification " - "[%s] from process %" PRIu64 ", but no delegates", - __FUNCTION__, lldb_private::StateAsCString(state), GetID()); + LLDB_LOGF(log, + "NativeProcessProtocol::%s: would send state notification " + "[%s] from process %" PRIu64 ", but no delegates", + __FUNCTION__, lldb_private::StateAsCString(state), GetID()); } } } void NativeProcessProtocol::NotifyDidExec() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - if (log) - log->Printf("NativeProcessProtocol::%s - preparing to call delegates", - __FUNCTION__); + LLDB_LOGF(log, "NativeProcessProtocol::%s - preparing to call delegates", + __FUNCTION__); { std::lock_guard<std::recursive_mutex> guard(m_delegates_mutex); diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp index 2f30d52aea6..fe40073eb59 100644 --- a/lldb/source/Host/common/NativeRegisterContext.cpp +++ b/lldb/source/Host/common/NativeRegisterContext.cpp @@ -114,16 +114,15 @@ lldb::addr_t NativeRegisterContext::GetPC(lldb::addr_t fail_value) { uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); - if (log) - log->Printf("NativeRegisterContext::%s using reg index %" PRIu32 - " (default %" PRIu64 ")", - __FUNCTION__, reg, fail_value); + LLDB_LOGF(log, + "NativeRegisterContext::%s using reg index %" PRIu32 + " (default %" PRIu64 ")", + __FUNCTION__, reg, fail_value); const uint64_t retval = ReadRegisterAsUnsigned(reg, fail_value); - if (log) - log->Printf("NativeRegisterContext::%s " PRIu32 " retval %" PRIu64, - __FUNCTION__, retval); + LLDB_LOGF(log, "NativeRegisterContext::%s " PRIu32 " retval %" PRIu64, + __FUNCTION__, retval); return retval; } @@ -192,20 +191,19 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info, RegisterValue value; Status error = ReadRegister(reg_info, value); if (error.Success()) { - if (log) - log->Printf("NativeRegisterContext::%s ReadRegister() succeeded, value " - "%" PRIu64, - __FUNCTION__, value.GetAsUInt64()); + LLDB_LOGF(log, + "NativeRegisterContext::%s ReadRegister() succeeded, value " + "%" PRIu64, + __FUNCTION__, value.GetAsUInt64()); return value.GetAsUInt64(); } else { - if (log) - log->Printf("NativeRegisterContext::%s ReadRegister() failed, error %s", - __FUNCTION__, error.AsCString()); + LLDB_LOGF(log, + "NativeRegisterContext::%s ReadRegister() failed, error %s", + __FUNCTION__, error.AsCString()); } } else { - if (log) - log->Printf("NativeRegisterContext::%s ReadRegister() null reg_info", - __FUNCTION__); + LLDB_LOGF(log, "NativeRegisterContext::%s ReadRegister() null reg_info", + __FUNCTION__); } return fail_value; } 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); diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp index 58f99f7832f..e84054f3f58 100644 --- a/lldb/source/Host/common/TCPSocket.cpp +++ b/lldb/source/Host/common/TCPSocket.cpp @@ -140,8 +140,7 @@ Status TCPSocket::CreateSocket(int domain) { Status TCPSocket::Connect(llvm::StringRef name) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_COMMUNICATION)); - if (log) - log->Printf("TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); + LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); Status error; std::string host_str; @@ -177,8 +176,7 @@ Status TCPSocket::Connect(llvm::StringRef name) { Status TCPSocket::Listen(llvm::StringRef name, int backlog) { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); - if (log) - log->Printf("TCPSocket::%s (%s)", __FUNCTION__, name.data()); + LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data()); Status error; std::string host_str; diff --git a/lldb/source/Host/common/UDPSocket.cpp b/lldb/source/Host/common/UDPSocket.cpp index 8dbf57d6fe4..03ad7f58797 100644 --- a/lldb/source/Host/common/UDPSocket.cpp +++ b/lldb/source/Host/common/UDPSocket.cpp @@ -58,8 +58,7 @@ Status UDPSocket::Connect(llvm::StringRef name, bool child_processes_inherit, std::unique_ptr<UDPSocket> final_socket; Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_CONNECTION)); - if (log) - log->Printf("UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); + LLDB_LOGF(log, "UDPSocket::%s (host/port = %s)", __FUNCTION__, name.data()); Status error; std::string host_str; |