[Lldb-commits] [lldb] r174693 - <rdar://problem/12898191>

Enrico Granata egranata at apple.com
Thu Feb 7 17:55:47 PST 2013


Author: enrico
Date: Thu Feb  7 19:55:46 2013
New Revision: 174693

URL: http://llvm.org/viewvc/llvm-project?rev=174693&view=rev
Log:
<rdar://problem/12898191>

Added a summary for NSMutableAttributedString
In the process, converted formatters for other NSString-based classes over to C++ code


Modified:
    lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
    lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h?rev=174693&r1=174692&r2=174693&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h Thu Feb  7 19:55:46 2013
@@ -82,6 +82,12 @@ namespace lldb_private {
         NSStringSummaryProvider (ValueObject& valobj, Stream& stream);
         
         bool
+        NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
+        
+        bool
+        NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream);
+        
+        bool
         ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream);
         
         template <bool is_sel_ptr>

Modified: lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp?rev=174693&r1=174692&r2=174693&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFormatterFunctions.cpp Thu Feb  7 19:55:46 2013
@@ -1013,6 +1013,37 @@ lldb_private::formatters::NSStringSummar
 }
 
 bool
+lldb_private::formatters::NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream)
+{
+    TargetSP target_sp(valobj.GetTargetSP());
+    if (!target_sp)
+        return false;
+    uint32_t addr_size = target_sp->GetArchitecture().GetAddressByteSize();
+    uint64_t pointee = valobj.GetValueAsUnsigned(0);
+    if (!pointee)
+        return false;
+    pointee += addr_size;
+    ClangASTType type(valobj.GetClangAST(),valobj.GetClangType());
+    ExecutionContext exe_ctx(target_sp,false);
+    ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress("string_ptr", pointee, exe_ctx, type));
+    if (!child_ptr_sp)
+        return false;
+    DataExtractor data;
+    child_ptr_sp->GetData(data);
+    ValueObjectSP child_sp(child_ptr_sp->CreateValueObjectFromData("string_data", data, exe_ctx, type));
+    child_sp->GetValueAsUnsigned(0);
+    if (child_sp)
+        return NSStringSummaryProvider(*child_sp, stream);
+    return false;
+}
+
+bool
+lldb_private::formatters::NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream)
+{
+    return NSAttributedStringSummaryProvider(valobj, stream);
+}
+
+bool
 lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream)
 {
     stream.Printf("%s",valobj.GetObjectDescription());

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=174693&r1=174692&r2=174693&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Thu Feb  7 19:55:46 2013
@@ -895,14 +895,17 @@ FormatManager::LoadObjCFormatters()
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
+    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
     
-    AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFString.CFAttributedString_SummaryProvider", ConstString("NSAttributedString"), appkit_flags);
-    
+    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags);
+    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags);
+    AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags);
+
     AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSBundle.NSBundle_SummaryProvider", ConstString("NSBundle"), appkit_flags);
 
     AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);





More information about the lldb-commits mailing list