[Lldb-commits] [PATCH] D48450: [DataFormatter] Add CFDictionary data formatter
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 21 12:18:28 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL335271: [DataFormatter] Add CFDictionary data formatter (authored by JDevlieghere, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D48450?vs=152354&id=152359#toc
Repository:
rL LLVM
https://reviews.llvm.org/D48450
Files:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -225,14 +225,18 @@
def nscontainers_data_formatter_commands(self):
self.expect(
- 'frame variable newArray newDictionary newMutableDictionary cfarray_ref mutable_array_ref',
+ 'frame variable newArray nsDictionary newDictionary nscfDictionary cfDictionaryRef newMutableDictionary cfarray_ref mutable_array_ref',
substrs=[
'(NSArray *) newArray = ',
'@"50 elements"',
'(NSDictionary *) newDictionary = ',
' 12 key/value pairs',
'(NSDictionary *) newMutableDictionary = ',
' 21 key/value pairs',
+ '(NSDictionary *) nsDictionary = ',
+ ' 2 key/value pairs',
+ '(CFDictionaryRef) cfDictionaryRef = ',
+ ' 3 key/value pairs',
'(CFArrayRef) cfarray_ref = ',
'@"3 elements"',
'(CFMutableArrayRef) mutable_array_ref = ',
Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -385,6 +385,11 @@
[newMutableDictionary setObject:@"foo" forKey:@"bar19"];
[newMutableDictionary setObject:@"foo" forKey:@"bar20"];
+ id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" };
+ id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" };
+ NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
+ CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
+
NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
[attrString isEqual:nil];
NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
Index: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -397,6 +397,7 @@
static const ConstString g_DictionaryMImmutable("__NSDictionaryM_Immutable");
static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
static const ConstString g_Dictionary0("__NSDictionary0");
+ static const ConstString g_DictionaryCF("__NSCFDictionary");
if (class_name.IsEmpty())
return false;
@@ -408,7 +409,8 @@
if (error.Fail())
return false;
value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
- } else if (class_name == g_DictionaryM || class_name == g_DictionaryMLegacy) {
+ } else if (class_name == g_DictionaryM || class_name == g_DictionaryMLegacy ||
+ class_name == g_DictionaryCF) {
AppleObjCRuntime *apple_runtime =
llvm::dyn_cast_or_null<AppleObjCRuntime>(runtime);
Status error;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48450.152359.patch
Type: text/x-patch
Size: 3677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180621/e1e92d6f/attachment.bin>
More information about the lldb-commits
mailing list