[Lldb-commits] [lldb] r169792 - in /lldb/trunk: source/Core/FormatManager.cpp test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/functionalities/data-formatter/data-formatter-objc/main.m
Enrico Granata
egranata at apple.com
Mon Dec 10 15:30:25 PST 2012
Author: enrico
Date: Mon Dec 10 17:30:25 2012
New Revision: 169792
URL: http://llvm.org/viewvc/llvm-project?rev=169792&view=rev
Log:
<rdar://problem/12709976>
Adding a summary for NSError
Modified:
lldb/trunk/source/Core/FormatManager.cpp
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=169792&r1=169791&r2=169792&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Mon Dec 10 17:30:25 2012
@@ -879,10 +879,10 @@
}
static void
-AddSummary(TypeCategoryImpl::SharedPointer category_sp,
- const char* string,
- ConstString type_name,
- TypeSummaryImpl::Flags flags)
+AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
+ const char* string,
+ ConstString type_name,
+ TypeSummaryImpl::Flags flags)
{
lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags,
string));
@@ -972,80 +972,80 @@
TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);
- AddSummary(corefoundation_category_sp,
- "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
- ConstString("CFGregorianUnits"),
- objc_flags);
- AddSummary(corefoundation_category_sp,
- "location=${var.location} length=${var.length}",
- ConstString("CFRange"),
- objc_flags);
- AddSummary(corefoundation_category_sp,
- "(x=${var.x}, y=${var.y})",
- ConstString("NSPoint"),
- objc_flags);
- AddSummary(corefoundation_category_sp,
- "location=${var.location}, length=${var.length}",
- ConstString("NSRange"),
- objc_flags);
- AddSummary(corefoundation_category_sp,
- "${var.origin}, ${var.size}",
- ConstString("NSRect"),
- objc_flags);
- AddSummary(corefoundation_category_sp,
- "(${var.origin}, ${var.size}), ...",
- ConstString("NSRectArray"),
- objc_flags);
- AddSummary(objc_category_sp,
- "(width=${var.width}, height=${var.height})",
- ConstString("NSSize"),
- objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
+ ConstString("CFGregorianUnits"),
+ objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "location=${var.location} length=${var.length}",
+ ConstString("CFRange"),
+ objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "(x=${var.x}, y=${var.y})",
+ ConstString("NSPoint"),
+ objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "location=${var.location}, length=${var.length}",
+ ConstString("NSRange"),
+ objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "${var.origin}, ${var.size}",
+ ConstString("NSRect"),
+ objc_flags);
+ AddStringSummary(corefoundation_category_sp,
+ "(${var.origin}, ${var.size}), ...",
+ ConstString("NSRectArray"),
+ objc_flags);
+ AddStringSummary(objc_category_sp,
+ "(width=${var.width}, height=${var.height})",
+ ConstString("NSSize"),
+ objc_flags);
TypeCategoryImpl::SharedPointer coregraphics_category_sp = GetCategory(m_coregraphics_category_name);
- AddSummary(coregraphics_category_sp,
- "(width=${var.width}, height=${var.height})",
- ConstString("CGSize"),
- objc_flags);
- AddSummary(coregraphics_category_sp,
- "(x=${var.x}, y=${var.y})",
- ConstString("CGPoint"),
- objc_flags);
- AddSummary(coregraphics_category_sp,
- "origin=${var.origin} size=${var.size}",
- ConstString("CGRect"),
- objc_flags);
+ AddStringSummary(coregraphics_category_sp,
+ "(width=${var.width}, height=${var.height})",
+ ConstString("CGSize"),
+ objc_flags);
+ AddStringSummary(coregraphics_category_sp,
+ "(x=${var.x}, y=${var.y})",
+ ConstString("CGPoint"),
+ objc_flags);
+ AddStringSummary(coregraphics_category_sp,
+ "origin=${var.origin} size=${var.size}",
+ ConstString("CGRect"),
+ objc_flags);
TypeCategoryImpl::SharedPointer coreservices_category_sp = GetCategory(m_coreservices_category_name);
- AddSummary(coreservices_category_sp,
- "red=${var.red} green=${var.green} blue=${var.blue}",
- ConstString("RGBColor"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
- ConstString("Rect"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "(v=${var.v}, h=${var.h})",
- ConstString("Point"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "${var.month}/${var.day}/${var.year} ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
- ConstString("DateTimeRect *"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
- ConstString("LongDateRect"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "(x=${var.x}, y=${var.y})",
- ConstString("HIPoint"),
- objc_flags);
- AddSummary(coreservices_category_sp,
- "origin=${var.origin} size=${var.size}",
- ConstString("HIRect"),
- objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "red=${var.red} green=${var.green} blue=${var.blue}",
+ ConstString("RGBColor"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
+ ConstString("Rect"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "(v=${var.v}, h=${var.h})",
+ ConstString("Point"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "${var.month}/${var.day}/${var.year} ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
+ ConstString("DateTimeRect *"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
+ ConstString("LongDateRect"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "(x=${var.x}, y=${var.y})",
+ ConstString("HIPoint"),
+ objc_flags);
+ AddStringSummary(coreservices_category_sp,
+ "origin=${var.origin} size=${var.size}",
+ ConstString("HIRect"),
+ objc_flags);
TypeCategoryImpl::SharedPointer appkit_category_sp = GetCategory(m_appkit_category_name);
@@ -1130,6 +1130,8 @@
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSNotification"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSNotification.NSNotification_SummaryProvider", ConstString("NSConcreteNotification"), appkit_flags);
+ AddStringSummary(appkit_category_sp, "domain: ${var._domain} - code: ${var._code}", ConstString("NSError"), appkit_flags);
+
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
AddCXXSummary(appkit_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
@@ -1170,7 +1172,10 @@
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSIndexSet"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.NSIndexSet.NSIndexSet_SummaryProvider", ConstString("NSMutableIndexSet"), appkit_flags);
- AddSummary(appkit_category_sp, "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"", ConstString("CFGregorianDate"), appkit_flags);
+ AddStringSummary(appkit_category_sp,
+ "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
+ ConstString("CFGregorianDate"),
+ appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("CFBitVectorRef"), appkit_flags);
AddScriptSummary(appkit_category_sp, "lldb.formatters.objc.CFBitVector.CFBitVector_SummaryProvider", ConstString("CFMutableBitVectorRef"), appkit_flags);
@@ -1189,61 +1194,61 @@
.SetShowMembersOneLiner(true)
.SetHideItemNames(true);
- AddSummary(vectors_category_sp,
- "${var.uint128}",
- ConstString("builtin_type_vec128"),
- objc_flags);
-
- AddSummary(vectors_category_sp,
- "",
- ConstString("float [4]"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("int32_t [4]"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("int16_t [8]"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vDouble"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vFloat"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vSInt8"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vSInt16"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vSInt32"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vUInt16"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vUInt8"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vUInt16"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vUInt32"),
- vector_flags);
- AddSummary(vectors_category_sp,
- "",
- ConstString("vBool32"),
- vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "${var.uint128}",
+ ConstString("builtin_type_vec128"),
+ objc_flags);
+
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("float [4]"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("int32_t [4]"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("int16_t [8]"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vDouble"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vFloat"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vSInt8"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vSInt16"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vSInt32"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vUInt16"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vUInt8"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vUInt16"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vUInt32"),
+ vector_flags);
+ AddStringSummary(vectors_category_sp,
+ "",
+ ConstString("vBool32"),
+ vector_flags);
}
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=169792&r1=169791&r2=169792&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Mon Dec 10 17:30:25 2012
@@ -295,6 +295,15 @@
'(NSURL *) nsurl2 =','@"page.html -- http://www.foo.bar',
'(NSURL *) nsurl3 = ','@"?whatever -- http://www.foo.bar/page.html"'])
+ self.expect('frame variable nserror',
+ substrs = ['domain: @"Foobar" - code: 12'])
+
+ self.expect('frame variable nserror->_userInfo',
+ substrs = ['2 key/value pairs'])
+
+ self.expect('frame variable nserror->_userInfo --ptr-depth 1 -d run-target',
+ substrs = ['@"a"','@"b"',"1","2"])
+
self.expect('frame variable bundle_string bundle_url main_bundle',
substrs = ['(NSBundle *) bundle_string = ',' @"/System/Library/Frameworks/Accelerate.framework"',
'(NSBundle *) bundle_url = ',' @"/System/Library/Frameworks/Cocoa.framework"',
Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=169792&r1=169791&r2=169792&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m Mon Dec 10 17:30:25 2012
@@ -507,6 +507,9 @@
CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref);
CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref);
+ NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2};
+ NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo];
+
NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"];
NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Cocoa.framework"]];
More information about the lldb-commits
mailing list