[Lldb-commits] [lldb] 520681e - [lldb] Fix incorrect uses of formatv specifiers in LLDB_LOG
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 5 11:27:59 PDT 2023
Author: Jonas Devlieghere
Date: 2023-07-05T11:27:52-07:00
New Revision: 520681e56d3ab9a9f187a1f9c805ff281b815d55
URL: https://github.com/llvm/llvm-project/commit/520681e56d3ab9a9f187a1f9c805ff281b815d55
DIFF: https://github.com/llvm/llvm-project/commit/520681e56d3ab9a9f187a1f9c805ff281b815d55.diff
LOG: [lldb] Fix incorrect uses of formatv specifiers in LLDB_LOG
Fix incorrect uses of formatv specifiers in LLDB_LOG. Unlike Python,
arguments must be numbered. All the affected log statements take
llvm:Errors so use the LLDB_LOG_ERROR macro instead.
Differential revision: https://reviews.llvm.org/D154532
Added:
Modified:
lldb/source/API/SBTarget.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/ThreadedCommunication.cpp
lldb/source/Host/common/ProcessLaunchInfo.cpp
lldb/source/Target/Process.cpp
Removed:
################################################################################
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 53b1bd6a535d62..3fef7428abe24b 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1117,8 +1117,8 @@ bool SBTarget::FindBreakpointsByName(const char *name,
llvm::Expected<std::vector<BreakpointSP>> expected_vector =
target_sp->GetBreakpointList().FindBreakpointsByName(name);
if (!expected_vector) {
- LLDB_LOG(GetLog(LLDBLog::Breakpoints), "invalid breakpoint name: {}",
- llvm::toString(expected_vector.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Breakpoints), expected_vector.takeError(),
+ "invalid breakpoint name: {0}");
return false;
}
for (BreakpointSP bkpt_sp : *expected_vector) {
@@ -1591,7 +1591,7 @@ const char *SBTarget::GetTriple() {
const char *SBTarget::GetABIName() {
LLDB_INSTRUMENT_VA(this);
-
+
TargetSP target_sp(GetSP());
if (!target_sp)
return nullptr;
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index bf672fe013847f..196038baa6d80a 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1915,8 +1915,8 @@ bool Debugger::StartEventHandlerThread() {
if (event_handler_thread) {
m_event_handler_thread = *event_handler_thread;
} else {
- LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}",
- llvm::toString(event_handler_thread.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Host), event_handler_thread.takeError(),
+ "failed to launch host thread: {0}");
}
// Make sure DefaultEventHandler() is running and listening to events
@@ -2056,8 +2056,8 @@ bool Debugger::StartIOHandlerThread() {
if (io_handler_thread) {
m_io_handler_thread = *io_handler_thread;
} else {
- LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}",
- llvm::toString(io_handler_thread.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Host), io_handler_thread.takeError(),
+ "failed to launch host thread: {0}");
}
}
return m_io_handler_thread.IsJoinable();
diff --git a/lldb/source/Core/ThreadedCommunication.cpp b/lldb/source/Core/ThreadedCommunication.cpp
index ec4b0806a80e43..755a158a5359e9 100644
--- a/lldb/source/Core/ThreadedCommunication.cpp
+++ b/lldb/source/Core/ThreadedCommunication.cpp
@@ -177,8 +177,8 @@ bool ThreadedCommunication::StartReadThread(Status *error_ptr) {
if (error_ptr)
*error_ptr = Status(maybe_thread.takeError());
else {
- LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}",
- llvm::toString(maybe_thread.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_thread.takeError(),
+ "failed to launch host thread: {0}");
}
}
diff --git a/lldb/source/Host/common/ProcessLaunchInfo.cpp b/lldb/source/Host/common/ProcessLaunchInfo.cpp
index 0e2c3da11ba9fb..a1866b2a99fd87 100644
--- a/lldb/source/Host/common/ProcessLaunchInfo.cpp
+++ b/lldb/source/Host/common/ProcessLaunchInfo.cpp
@@ -182,8 +182,8 @@ bool ProcessLaunchInfo::MonitorProcess() const {
llvm::Expected<HostThread> maybe_thread =
Host::StartMonitoringChildProcess(m_monitor_callback, GetProcessID());
if (!maybe_thread)
- LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}",
- llvm::toString(maybe_thread.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Host), maybe_thread.takeError(),
+ "failed to launch host thread: {0}");
return true;
}
return false;
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index ca2eac7d8e5b04..05ddbbd146a20f 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3600,8 +3600,8 @@ bool Process::StartPrivateStateThread(bool is_secondary_thread) {
},
8 * 1024 * 1024);
if (!private_state_thread) {
- LLDB_LOG(GetLog(LLDBLog::Host), "failed to launch host thread: {}",
- llvm::toString(private_state_thread.takeError()));
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Host), private_state_thread.takeError(),
+ "failed to launch host thread: {0}");
return false;
}
More information about the lldb-commits
mailing list