aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2023-06-06 12:25:41 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2023-06-06 13:02:43 -0700
commit7cd1d4231a7c83e719b83c6abbe2d479baa03808 (patch)
tree8682191ea0bede9c23e2757c5762f18efbe4629d /lldb
parentfebcf99e9d2c82f121fcf35ad36badf9b8ff8052 (diff)
downloadllvm-7cd1d4231a7c83e719b83c6abbe2d479baa03808.zip
llvm-7cd1d4231a7c83e719b83c6abbe2d479baa03808.tar.gz
llvm-7cd1d4231a7c83e719b83c6abbe2d479baa03808.tar.bz2
[lldb] Remove __FUNCTION__ from log messages in lldbHost (NFC)
LLDB's logging infrastructure supports prepending log messages with the name of the file and function that generates the log (see help log enable). Therefore it's unnecessary to include the current __FUNCTION__ in the log message itself. This patch removes __FUNCTION__ from log messages in the Host library. Differential revision: https://reviews.llvm.org/D151762
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp16
-rw-r--r--lldb/source/Host/common/NativeRegisterContext.cpp22
-rw-r--r--lldb/source/Host/common/TCPSocket.cpp4
-rw-r--r--lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm13
4 files changed, 22 insertions, 33 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 0c0d786..5c44c2f 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -225,24 +225,20 @@ bool HostInfoBase::ComputePathRelativeToLibrary(FileSpec &file_spec,
return false;
std::string raw_path = lldb_file_spec.GetPath();
- LLDB_LOGF(log,
- "HostInfo::%s() attempting to "
- "derive the path %s relative to liblldb install path: %s",
- __FUNCTION__, dir.data(), raw_path.c_str());
+ LLDB_LOG(
+ log,
+ "Attempting to derive the path {0} relative to liblldb install path: {1}",
+ dir, raw_path);
// Drop bin (windows) or lib
llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path);
if (parent_path.empty()) {
- LLDB_LOGF(log,
- "HostInfo::%s() failed to find liblldb within the shared "
- "lib path",
- __FUNCTION__);
+ LLDB_LOG(log, "Failed to find liblldb within the shared lib path");
return false;
}
raw_path = (parent_path + dir).str();
- LLDB_LOGF(log, "HostInfo::%s() derived the path as: %s", __FUNCTION__,
- raw_path.c_str());
+ LLDB_LOG(log, "Derived the path as: {0}", raw_path);
file_spec.SetDirectory(raw_path);
return (bool)file_spec.GetDirectory();
}
diff --git a/lldb/source/Host/common/NativeRegisterContext.cpp b/lldb/source/Host/common/NativeRegisterContext.cpp
index 1be519d..411f5f5 100644
--- a/lldb/source/Host/common/NativeRegisterContext.cpp
+++ b/lldb/source/Host/common/NativeRegisterContext.cpp
@@ -125,15 +125,12 @@ lldb::addr_t NativeRegisterContext::GetPC(lldb::addr_t fail_value) {
uint32_t reg = ConvertRegisterKindToRegisterNumber(eRegisterKindGeneric,
LLDB_REGNUM_GENERIC_PC);
- LLDB_LOGF(log,
- "NativeRegisterContext::%s using reg index %" PRIu32
- " (default %" PRIu64 ")",
- __FUNCTION__, reg, fail_value);
+ LLDB_LOGF(log, "Using reg index %" PRIu32 " (default %" PRIu64 ")", reg,
+ fail_value);
const uint64_t retval = ReadRegisterAsUnsigned(reg, fail_value);
- LLDB_LOGF(log, "NativeRegisterContext::%s " PRIu32 " retval %" PRIu64,
- __FUNCTION__, retval);
+ LLDB_LOGF(log, PRIu32 " retval %" PRIu64, retval);
return retval;
}
@@ -203,18 +200,15 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
Status error = ReadRegister(reg_info, value);
if (error.Success()) {
LLDB_LOGF(log,
- "NativeRegisterContext::%s ReadRegister() succeeded, value "
+ "Read register succeeded: value "
"%" PRIu64,
- __FUNCTION__, value.GetAsUInt64());
+ value.GetAsUInt64());
return value.GetAsUInt64();
} else {
- LLDB_LOGF(log,
- "NativeRegisterContext::%s ReadRegister() failed, error %s",
- __FUNCTION__, error.AsCString());
+ LLDB_LOGF(log, "Read register failed: error %s", error.AsCString());
}
} else {
- LLDB_LOGF(log, "NativeRegisterContext::%s ReadRegister() null reg_info",
- __FUNCTION__);
+ LLDB_LOGF(log, "Read register failed: null reg_info");
}
return fail_value;
}
@@ -222,7 +216,7 @@ NativeRegisterContext::ReadRegisterAsUnsigned(const RegisterInfo *reg_info,
Status NativeRegisterContext::WriteRegisterFromUnsigned(uint32_t reg,
uint64_t uval) {
if (reg == LLDB_INVALID_REGNUM)
- return Status("NativeRegisterContext::%s (): reg is invalid", __FUNCTION__);
+ return Status("Write register failed: reg is invalid");
return WriteRegisterFromUnsigned(GetRegisterInfoAtIndex(reg), uval);
}
diff --git a/lldb/source/Host/common/TCPSocket.cpp b/lldb/source/Host/common/TCPSocket.cpp
index 82b00ac..df47372 100644
--- a/lldb/source/Host/common/TCPSocket.cpp
+++ b/lldb/source/Host/common/TCPSocket.cpp
@@ -150,7 +150,7 @@ Status TCPSocket::CreateSocket(int domain) {
Status TCPSocket::Connect(llvm::StringRef name) {
Log *log = GetLog(LLDBLog::Communication);
- LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
+ LLDB_LOG(log, "Connect to host/port {0}", name);
Status error;
llvm::Expected<HostAndPort> host_port = DecodeHostAndPort(name);
@@ -189,7 +189,7 @@ Status TCPSocket::Connect(llvm::StringRef name) {
Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
Log *log = GetLog(LLDBLog::Connection);
- LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data());
+ LLDB_LOG(log, "Listen to {0}", name);
Status error;
llvm::Expected<HostAndPort> host_port = DecodeHostAndPort(name);
diff --git a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
index c80d200..06b8df8 100644
--- a/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ b/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -152,8 +152,7 @@ bool HostInfoMacOSX::ComputeSupportExeDirectory(FileSpec &file_spec) {
FileSystem::Instance().Resolve(support_dir_spec);
if (!FileSystem::Instance().IsDirectory(support_dir_spec)) {
Log *log = GetLog(LLDBLog::Host);
- LLDB_LOGF(log, "HostInfoMacOSX::%s(): failed to find support directory",
- __FUNCTION__);
+ LLDB_LOG(log, "failed to find support directory");
return false;
}
@@ -342,8 +341,8 @@ FileSpec HostInfoMacOSX::GetXcodeContentsDirectory() {
HostInfo::GetSDKRoot(SDKOptions{XcodeSDK::GetAnyMacOS()});
if (!sdk_path_or_err) {
Log *log = GetLog(LLDBLog::Host);
- LLDB_LOGF(log, "Error while searching for Xcode SDK: %s",
- toString(sdk_path_or_err.takeError()).c_str());
+ LLDB_LOG_ERROR(log, sdk_path_or_err.takeError(),
+ "Error while searching for Xcode SDK: {0}");
return;
}
FileSpec fspec(*sdk_path_or_err);
@@ -496,7 +495,7 @@ static llvm::Expected<std::string> GetXcodeSDK(XcodeSDK sdk) {
if (!path.empty())
break;
}
- LLDB_LOGF(log, "Couldn't find SDK %s on host", sdk_name.c_str());
+ LLDB_LOG(log, "Couldn't find SDK {0} on host", sdk_name);
// Try without the version.
if (!info.version.empty()) {
@@ -510,13 +509,13 @@ static llvm::Expected<std::string> GetXcodeSDK(XcodeSDK sdk) {
break;
}
- LLDB_LOGF(log, "Couldn't find any matching SDK on host");
+ LLDB_LOG(log, "Couldn't find any matching SDK on host");
return "";
}
// Whatever is left in output should be a valid path.
if (!FileSystem::Instance().Exists(path)) {
- LLDB_LOGF(log, "SDK returned by xcrun doesn't exist");
+ LLDB_LOG(log, "SDK returned by xcrun doesn't exist");
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"SDK returned by xcrun doesn't exist");
}