diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-24 17:56:10 +0000 |
| commit | 63e5fb76ecfed3434252868d8cf07d676f979f2f (patch) | |
| tree | 349d6bd303f53aa57b988dee284c7f264404a8fc /lldb/source/Plugins/Platform/Android | |
| parent | 2bf871be4c35d70db080dde789cf9bb334c04057 (diff) | |
| download | bcm5719-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/Platform/Android')
| -rw-r--r-- | lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp | 28 | ||||
| -rw-r--r-- | lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp | 26 |
2 files changed, 23 insertions, 31 deletions
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index 3b8c9206ca3..7076872dcaf 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -68,8 +68,8 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { const char *triple_cstr = arch ? arch->GetTriple().getTriple().c_str() : "<null>"; - log->Printf("PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__, - force ? "true" : "false", arch_name, triple_cstr); + LLDB_LOGF(log, "PlatformAndroid::%s(force=%s, arch={%s,%s})", __FUNCTION__, + force ? "true" : "false", arch_name, triple_cstr); } bool create = force; @@ -113,16 +113,14 @@ PlatformSP PlatformAndroid::CreateInstance(bool force, const ArchSpec *arch) { } if (create) { - if (log) - log->Printf("PlatformAndroid::%s() creating remote-android platform", - __FUNCTION__); + LLDB_LOGF(log, "PlatformAndroid::%s() creating remote-android platform", + __FUNCTION__); return PlatformSP(new PlatformAndroid(false)); } - if (log) - log->Printf( - "PlatformAndroid::%s() aborting creation of remote-android platform", - __FUNCTION__); + LLDB_LOGF( + log, "PlatformAndroid::%s() aborting creation of remote-android platform", + __FUNCTION__); return PlatformSP(); } @@ -212,9 +210,8 @@ Status PlatformAndroid::GetFile(const FileSpec &source, auto source_file = source_spec.GetCString(false); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("Got mode == 0 on '%s': try to get file via 'shell cat'", - source_file); + LLDB_LOGF(log, "Got mode == 0 on '%s': try to get file via 'shell cat'", + source_file); if (strchr(source_file, '\'') != nullptr) return Status("Doesn't support single-quotes in filenames"); @@ -288,9 +285,8 @@ uint32_t PlatformAndroid::GetSdkVersion() { if (error.Fail() || version_string.empty()) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM); - if (log) - log->Printf("Get SDK version failed. (error: %s, output: %s)", - error.AsCString(), version_string.c_str()); + LLDB_LOGF(log, "Get SDK version failed. (error: %s, output: %s)", + error.AsCString(), version_string.c_str()); return 0; } @@ -337,7 +333,7 @@ Status PlatformAndroid::DownloadSymbolFile(const lldb::ModuleSP &module_sp, Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log && error.Fail()) - log->Printf("Failed to remove temp directory: %s", error.AsCString()); + LLDB_LOGF(log, "Failed to remove temp directory: %s", error.AsCString()); }); FileSpec symfile_platform_filespec(tmpdir); diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp index e36527dc129..64b6fdb9079 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -36,19 +36,16 @@ static Status ForwardPortWithAdb( return error; device_id = adb.GetDeviceID(); - if (log) - log->Printf("Connected to Android device \"%s\"", device_id.c_str()); + LLDB_LOGF(log, "Connected to Android device \"%s\"", device_id.c_str()); if (remote_port != 0) { - if (log) - log->Printf("Forwarding remote TCP port %d to local TCP port %d", - remote_port, local_port); + LLDB_LOGF(log, "Forwarding remote TCP port %d to local TCP port %d", + remote_port, local_port); return adb.SetPortForwarding(local_port, remote_port); } - if (log) - log->Printf("Forwarding remote socket \"%s\" to local TCP port %d", - remote_socket_name.str().c_str(), local_port); + LLDB_LOGF(log, "Forwarding remote socket \"%s\" to local TCP port %d", + remote_socket_name.str().c_str(), local_port); if (!socket_namespace) return Status("Invalid socket namespace"); @@ -95,7 +92,7 @@ bool PlatformAndroidRemoteGDBServer::LaunchGDBServer(lldb::pid_t &pid, auto error = MakeConnectURL(pid, remote_port, socket_name.c_str(), connect_url); if (error.Success() && log) - log->Printf("gdbserver connect URL: %s", connect_url.c_str()); + LLDB_LOGF(log, "gdbserver connect URL: %s", connect_url.c_str()); return error.Success(); } @@ -139,8 +136,7 @@ Status PlatformAndroidRemoteGDBServer::ConnectRemote(Args &args) { args.ReplaceArgumentAtIndex(0, connect_url); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM)); - if (log) - log->Printf("Rewritten platform connect URL: %s", connect_url.c_str()); + LLDB_LOGF(log, "Rewritten platform connect URL: %s", connect_url.c_str()); error = PlatformRemoteGDBServer::ConnectRemote(args); if (error.Fail()) @@ -164,10 +160,10 @@ void PlatformAndroidRemoteGDBServer::DeleteForwardPort(lldb::pid_t pid) { const auto port = it->second; const auto error = DeleteForwardPortWithAdb(port, m_device_id); if (error.Fail()) { - if (log) - log->Printf("Failed to delete port forwarding (pid=%" PRIu64 - ", port=%d, device=%s): %s", - pid, port, m_device_id.c_str(), error.AsCString()); + LLDB_LOGF(log, + "Failed to delete port forwarding (pid=%" PRIu64 + ", port=%d, device=%s): %s", + pid, port, m_device_id.c_str(), error.AsCString()); } m_port_forwards.erase(it); } |

