[Lldb-commits] [lldb] 55bc048 - Improve and modernize logging for Process::CompleteAttach() (#82717)

via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 23 08:01:02 PST 2024


Author: Adrian Prantl
Date: 2024-02-23T08:00:58-08:00
New Revision: 55bc0488af077acb47be70542718d1bc17f3de4f

URL: https://github.com/llvm/llvm-project/commit/55bc0488af077acb47be70542718d1bc17f3de4f
DIFF: https://github.com/llvm/llvm-project/commit/55bc0488af077acb47be70542718d1bc17f3de4f.diff

LOG: Improve and modernize logging for Process::CompleteAttach() (#82717)

Target::SetArchitecture() does not necessarily set the triple that is
being passed in, and will unconditionally log the real architecture to
the log channel. By flipping the order between the log outputs, the
resulting combined log makes a lot more sense to read.

Added: 
    

Modified: 
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 23a8a66645c02d..137795cb8cec9e 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2937,14 +2937,11 @@ void Process::CompleteAttach() {
   DidAttach(process_arch);
 
   if (process_arch.IsValid()) {
+    LLDB_LOG(log,
+             "Process::{0} replacing process architecture with DidAttach() "
+             "architecture: \"{1}\"",
+             __FUNCTION__, process_arch.GetTriple().getTriple());
     GetTarget().SetArchitecture(process_arch);
-    if (log) {
-      const char *triple_str = process_arch.GetTriple().getTriple().c_str();
-      LLDB_LOGF(log,
-                "Process::%s replacing process architecture with DidAttach() "
-                "architecture: %s",
-                __FUNCTION__, triple_str ? triple_str : "<null>");
-    }
   }
 
   // We just attached.  If we have a platform, ask it for the process


        


More information about the lldb-commits mailing list