[Lldb-commits] [lldb] Colorize output when searching for symbols in lldb (PR #69422)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 14 01:34:17 PST 2023


================
@@ -252,11 +253,16 @@ void Symbol::GetDescription(Stream *s, lldb::DescriptionLevel level,
       s->Printf(", value = 0x%16.16" PRIx64,
                 m_addr_range.GetBaseAddress().GetOffset());
   }
-  ConstString demangled = GetMangled().GetDemangledName();
-  if (demangled)
-    s->Printf(", name=\"%s\"", demangled.AsCString());
-  if (m_mangled.GetMangledName())
-    s->Printf(", mangled=\"%s\"", m_mangled.GetMangledName().AsCString());
+  if (ConstString mangled_name = m_mangled.GetMangledName()) {
+    s->Printf(", mangled=\"");
+    Address::DumpName(s, mangled_name.GetStringRef(), pattern);
+    s->Printf("\"");
+  }
+  if (ConstString demangled = m_mangled.GetDemangledName()) {
+    s->Printf(", name=\"");
+    Address::DumpName(s, demangled.GetStringRef(), pattern);
+    s->Printf("\"");
----------------
DavidSpickett wrote:

This is almost right, but we want demangled first, then mangled, to exactly match the previous code.

The reasoning here is that the demangled name is going to be more useful, if we have it, than the mangled name. Demangled might be `foo(std::vector<....` whereas the mangled is like `12fa_foo3421(asfd<` (exaggerating but you get the idea).

https://github.com/llvm/llvm-project/pull/69422


More information about the lldb-commits mailing list