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/Host/common/Host.cpp | |
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/Host/common/Host.cpp')
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 39 |
1 files changed, 18 insertions, 21 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; } |