[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)

via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 14 16:39:44 PST 2024


================
@@ -883,8 +906,17 @@ static bool DumpValue(Stream &s, const SymbolContext *sc,
   }
 
   if (!is_array_range) {
-    LLDB_LOGF(log,
-              "[Debugger::FormatPrompt] dumping ordinary printable output");
+    if (!entry.printf_format.empty()) {
+      if (DumpValueWithPrintf(s, entry.printf_format, *target)) {
+        LLDB_LOGF(log, "dumping using printf format");
+        return true;
+      } else {
+        LLDB_LOG(log,
+                 "unsupported printf format '{0}' - for type info flags {1}",
+                 entry.printf_format, target->GetTypeInfo());
+      }
+    }
+    LLDB_LOGF(log, "dumping ordinary printable output");
----------------
jimingham wrote:

Should this silently eat errors if the format string is bad?

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


More information about the lldb-commits mailing list