JDevlieghere created this revision.
JDevlieghere added a reviewer: LLDB.
Herald added a project: All.
JDevlieghere requested review of this revision.

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.


https://reviews.llvm.org/D151762

Files:
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/common/NativeRegisterContext.cpp
  lldb/source/Host/common/TCPSocket.cpp
  lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm

Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
===================================================================
--- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
+++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm
@@ -152,8 +152,7 @@
     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;
     }
 
Index: lldb/source/Host/common/TCPSocket.cpp
===================================================================
--- lldb/source/Host/common/TCPSocket.cpp
+++ lldb/source/Host/common/TCPSocket.cpp
@@ -150,7 +150,7 @@
 Status TCPSocket::Connect(llvm::StringRef name) {
 
   Log *log = GetLog(LLDBLog::Communication);
-  LLDB_LOGF(log, "TCPSocket::%s (host/port = %s)", __FUNCTION__, name.data());
+  LLDB_LOGF(log, "Connect to host/port %s", name.data());
 
   Status error;
   llvm::Expected<HostAndPort> host_port = DecodeHostAndPort(name);
@@ -189,7 +189,7 @@
 
 Status TCPSocket::Listen(llvm::StringRef name, int backlog) {
   Log *log = GetLog(LLDBLog::Connection);
-  LLDB_LOGF(log, "TCPSocket::%s (%s)", __FUNCTION__, name.data());
+  LLDB_LOGF(log, "Listen to %s", name.data());
 
   Status error;
   llvm::Expected<HostAndPort> host_port = DecodeHostAndPort(name);
Index: lldb/source/Host/common/NativeRegisterContext.cpp
===================================================================
--- lldb/source/Host/common/NativeRegisterContext.cpp
+++ lldb/source/Host/common/NativeRegisterContext.cpp
@@ -125,15 +125,12 @@
 
   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 @@
     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 @@
 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);
 }
 
Index: lldb/source/Host/common/HostInfoBase.cpp
===================================================================
--- lldb/source/Host/common/HostInfoBase.cpp
+++ lldb/source/Host/common/HostInfoBase.cpp
@@ -225,24 +225,20 @@
     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_LOGF(
+      log,
+      "Attempting to derive the path %s relative to liblldb install path: %s",
+      dir.data(), raw_path.c_str());
 
   // 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_LOGF(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_LOGF(log, "Derived the path as: %s", raw_path.c_str());
   file_spec.SetDirectory(raw_path);
   return (bool)file_spec.GetDirectory();
 }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to