[Lldb-commits] [lldb] r336993 - Adjust thread name column width depending on real name length.

Tatyana Krasnukha via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 13 04:49:28 PDT 2018


Author: tkrasnukha
Date: Fri Jul 13 04:49:28 2018
New Revision: 336993

URL: http://llvm.org/viewvc/llvm-project?rev=336993&view=rev
Log:
Adjust thread name column width depending on real name length.

Make 16-byte aligned field instead of truncating a name to 16 byte.

Modified:
    lldb/trunk/source/Utility/Log.cpp

Modified: lldb/trunk/source/Utility/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Log.cpp?rev=336993&r1=336992&r2=336993&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Log.cpp (original)
+++ lldb/trunk/source/Utility/Log.cpp Fri Jul 13 04:49:28 2018
@@ -286,7 +286,11 @@ void Log::WriteHeader(llvm::raw_ostream
   if (options.Test(LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) {
     llvm::SmallString<32> thread_name;
     llvm::get_thread_name(thread_name);
-    OS << llvm::formatv("{0,-16} ", thread_name);
+
+    llvm::SmallString<12> format_str;
+    llvm::raw_svector_ostream format_os(format_str);
+    format_os << "{0,-" << llvm::alignTo<16>(thread_name.size()) << "} ";
+    OS << llvm::formatv(format_str.c_str(), thread_name);
   }
 
   if (options.Test(LLDB_LOG_OPTION_BACKTRACE))




More information about the lldb-commits mailing list