[Lldb-commits] [PATCH] D15773: Add LogDump methods to lldb_private::StringList to ease printing of iterable string containers

Luke Drummond via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 5 07:57:28 PST 2016


ldrumm added a subscriber: lldb-commits.
ldrumm updated this revision to Diff 44000.
ldrumm added a comment.

Addresses @clayborg's feedback in http://reviews.llvm.org/D15773


http://reviews.llvm.org/D15773

Files:
  source/Core/StringList.cpp

Index: source/Core/StringList.cpp
===================================================================
--- source/Core/StringList.cpp
+++ source/Core/StringList.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Core/StreamString.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Core/StreamString.h"
 
 #include <string>
 
@@ -362,10 +363,16 @@
 {
     if (!log)
         return;
+
+    StreamString strm;
     if (name)
-        log->Debug("Begin %s:", name);
-    for (const auto &s : m_strings)
-        log->Debug("\t%s", s.c_str());
+        strm.Printf("Begin %s:\n", name);
+    for (const auto &s : m_strings) {
+        strm.Indent();
+        strm.Printf("%s\n", s.c_str());
+    }
     if (name)
-        log->Debug("End %s.", name);
+        strm.Printf("End %s.\n", name);
+
+    log->Debug("%s", strm.GetData());
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15773.44000.patch
Type: text/x-patch
Size: 847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160105/98c6d11e/attachment.bin>


More information about the lldb-commits mailing list