[Lldb-commits] [PATCH] D13657: [lldb] char summary provider

Eugene Leviant via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 05:45:00 PDT 2015


evgeny777 updated this revision to Diff 37339.
evgeny777 added a comment.

Looks like can be done much easier


http://reviews.llvm.org/D13657

Files:
  include/lldb/API/SBTypeSummary.h
  source/API/SBTypeSummary.cpp

Index: source/API/SBTypeSummary.cpp
===================================================================
--- source/API/SBTypeSummary.cpp
+++ source/API/SBTypeSummary.cpp
@@ -146,6 +146,25 @@
     return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data)));
 }
 
+SBTypeSummary
+SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
+{
+    return SBTypeSummary(
+               TypeSummaryImplSP(
+                   new CXXFunctionSummaryFormat(options, 
+                       [cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
+                            SBStream stream;
+                            if (!cb(valobj.GetSP(), &opt, stream))
+                                return false;
+                            stm.Write(stream.GetData(), stream.GetSize());
+                            return true;
+                       },
+                       "SBTypeSummary formatter callbacxk"
+                   )
+                )
+            );    
+}
+
 SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
 m_opaque_sp(rhs.m_opaque_sp)
 {
Index: include/lldb/API/SBTypeSummary.h
===================================================================
--- include/lldb/API/SBTypeSummary.h
+++ include/lldb/API/SBTypeSummary.h
@@ -69,6 +69,8 @@
     class SBTypeSummary
     {
     public:
+        // Native function summary formatter callback
+        typedef bool (*FormatCallback) (SBValue, SBTypeSummaryOptions, SBStream&);
         
         SBTypeSummary();
         
@@ -83,6 +85,9 @@
         static SBTypeSummary
         CreateWithScriptCode (const char* data,
                               uint32_t options = 0); // see lldb::eTypeOption values
+        static SBTypeSummary
+        CreateWithCallback (FormatCallback cb, 
+                            uint32_t options = 0);
         
         SBTypeSummary (const lldb::SBTypeSummary &rhs);
         


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13657.37339.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151014/65eefcb0/attachment-0001.bin>


More information about the lldb-commits mailing list