summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-24 17:56:10 +0000
commit63e5fb76ecfed3434252868d8cf07d676f979f2f (patch)
tree349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
parent2bf871be4c35d70db080dde789cf9bb334c04057 (diff)
downloadbcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.tar.gz
bcm5719-llvm-63e5fb76ecfed3434252868d8cf07d676f979f2f.zip
[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)
This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp82
1 files changed, 40 insertions, 42 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 9797184026e..8ebeaf03be9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -439,8 +439,7 @@ void GDBRemoteCommunicationClient::GetRemoteQSupported() {
m_max_packet_size = UINT64_MAX; // Must have been a garbled response
Log *log(
ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
- if (log)
- log->Printf("Garbled PacketSize spec in qSupported response");
+ LLDB_LOGF(log, "Garbled PacketSize spec in qSupported response");
}
}
}
@@ -525,9 +524,10 @@ GDBRemoteCommunicationClient::SendThreadSpecificPacketAndWaitForResponse(
if (!lock) {
if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(
GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
- log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
- "for %s packet.",
- __FUNCTION__, payload.GetData());
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
+ "for %s packet.",
+ __FUNCTION__, payload.GetData());
return PacketResult::ErrorNoSequenceLock;
}
@@ -660,10 +660,10 @@ GDBRemoteCommunicationClient::SendPacketsAndConcatenateResponses(
if (!lock) {
Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
GDBR_LOG_PACKETS));
- if (log)
- log->Printf("error: failed to get packet sequence mutex, not sending "
- "packets with prefix '%s'",
- payload_prefix);
+ LLDB_LOGF(log,
+ "error: failed to get packet sequence mutex, not sending "
+ "packets with prefix '%s'",
+ payload_prefix);
return PacketResult::ErrorNoSequenceLock;
}
@@ -1284,14 +1284,15 @@ bool GDBRemoteCommunicationClient::GetHostInfo(bool force) {
assert(byte_order == m_host_arch.GetByteOrder());
}
- if (log)
- log->Printf("GDBRemoteCommunicationClient::%s parsed host "
- "architecture as %s, triple as %s from triple text %s",
- __FUNCTION__, m_host_arch.GetArchitectureName()
- ? m_host_arch.GetArchitectureName()
- : "<null-arch-name>",
- m_host_arch.GetTriple().getTriple().c_str(),
- triple.c_str());
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s parsed host "
+ "architecture as %s, triple as %s from triple text %s",
+ __FUNCTION__,
+ m_host_arch.GetArchitectureName()
+ ? m_host_arch.GetArchitectureName()
+ : "<null-arch-name>",
+ m_host_arch.GetTriple().getTriple().c_str(),
+ triple.c_str());
}
if (!distribution_id.empty())
m_host_arch.SetDistributionId(distribution_id.c_str());
@@ -2064,12 +2065,10 @@ bool GDBRemoteCommunicationClient::GetCurrentProcessInfo(bool allow_lazy) {
break;
case llvm::Triple::Wasm:
case llvm::Triple::XCOFF:
- if (log)
- log->Printf("error: not supported target architecture");
+ LLDB_LOGF(log, "error: not supported target architecture");
return false;
case llvm::Triple::UnknownObjectFormat:
- if (log)
- log->Printf("error: failed to determine target architecture");
+ LLDB_LOGF(log, "error: failed to determine target architecture");
return false;
}
@@ -2641,9 +2640,8 @@ bool GDBRemoteCommunicationClient::GetThreadStopInfo(
uint8_t GDBRemoteCommunicationClient::SendGDBStoppointTypePacket(
GDBStoppointType type, bool insert, addr_t addr, uint32_t length) {
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
- if (log)
- log->Printf("GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
- __FUNCTION__, insert ? "add" : "remove", addr);
+ LLDB_LOGF(log, "GDBRemoteCommunicationClient::%s() %s at addr = 0x%" PRIx64,
+ __FUNCTION__, insert ? "add" : "remove", addr);
// Check if the stub is known not to support this breakpoint type
if (!SupportsGDBStoppointPacket(type))
@@ -2745,9 +2743,8 @@ size_t GDBRemoteCommunicationClient::GetCurrentThreadIDs(
#if !defined(LLDB_CONFIGURATION_DEBUG)
Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS |
GDBR_LOG_PACKETS));
- if (log)
- log->Printf("error: failed to get packet sequence mutex, not sending "
- "packet 'qfThreadInfo'");
+ LLDB_LOGF(log, "error: failed to get packet sequence mutex, not sending "
+ "packet 'qfThreadInfo'");
#endif
sequence_mutex_unavailable = true;
}
@@ -3873,9 +3870,9 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups(
} else if (Log *log = ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(
GDBR_LOG_PROCESS | GDBR_LOG_PACKETS)) {
- log->Printf(
- "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex.",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s: Didn't get sequence mutex.",
+ __FUNCTION__);
}
}
}
@@ -3899,26 +3896,27 @@ GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins() {
!m_supported_async_json_packets_sp->GetAsArray()) {
// We were returned something other than a JSON array. This is
// invalid. Clear it out.
- if (log)
- log->Printf("GDBRemoteCommunicationClient::%s(): "
- "QSupportedAsyncJSONPackets returned invalid "
- "result: %s",
- __FUNCTION__, response.GetStringRef().c_str());
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s(): "
+ "QSupportedAsyncJSONPackets returned invalid "
+ "result: %s",
+ __FUNCTION__, response.GetStringRef().c_str());
m_supported_async_json_packets_sp.reset();
}
} else {
- if (log)
- log->Printf("GDBRemoteCommunicationClient::%s(): "
- "QSupportedAsyncJSONPackets unsupported",
- __FUNCTION__);
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s(): "
+ "QSupportedAsyncJSONPackets unsupported",
+ __FUNCTION__);
}
if (log && m_supported_async_json_packets_sp) {
StreamString stream;
m_supported_async_json_packets_sp->Dump(stream);
- log->Printf("GDBRemoteCommunicationClient::%s(): supported async "
- "JSON packets: %s",
- __FUNCTION__, stream.GetData());
+ LLDB_LOGF(log,
+ "GDBRemoteCommunicationClient::%s(): supported async "
+ "JSON packets: %s",
+ __FUNCTION__, stream.GetData());
}
}
OpenPOWER on IntegriCloud