[all-commits] [llvm/llvm-project] 8f5beb: [lldb/Dataformatter] Add support for CoreFoundatio...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Mon Apr 27 13:12:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f5beb4c4b114f2cd827b10b5358f0d79d8bb691
      https://github.com/llvm/llvm-project/commit/8f5beb4c4b114f2cd827b10b5358f0d79d8bb691
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2020-04-27 (Mon, 27 Apr 2020)

  Changed paths:
    A lldb/source/Plugins/Language/ObjC/CFBasicHash.cpp
    A lldb/source/Plugins/Language/ObjC/CFBasicHash.h
    M lldb/source/Plugins/Language/ObjC/CMakeLists.txt
    M lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
    M lldb/source/Plugins/Language/ObjC/NSDictionary.h
    M lldb/source/Plugins/Language/ObjC/NSSet.cpp
    M lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
    M lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCNSContainer.py
    M lldb/test/API/functionalities/data-formatter/data-formatter-objc/main.m

  Log Message:
  -----------
  [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets.

This patch improves data formatting for CoreFoundation containers:
CFDictionary and CFSet.

These data formatters make the containers and their children appear in Xcode's
variables view (and on the command line) without having to expand the
data structure.

Previous implementation only supported showing the container's element count.

```
(lldb) frame var dict
(__NSCFDictionary *) dict = 0x00000001004062b0 2 key/value pairs

(lldb) frame var set
(__NSCFSet *) set = 0x0000000100406330 2 elements
```
Now the variable can be dereferenced to dispaly the container's children:

```
(lldb) frame var *dict
(__NSCFDictionary) *dict = {
  [0] = {
    key = 0x0000000100004050 @"123"
    value = 0x0000000100004090 @"456"
  }
  [1] = {
    key = 0x0000000100004030 @"abc"
    value = 0x0000000100004070 @"def"
  }
}

(lldb) frame var *set
(__NSCFSet) *set = {
  [0] = 0x0000000100004050 @"123"
  [1] = 0x0000000100004030 @"abc"
}
```

rdar://39882287

Differential Revision: https://reviews.llvm.org/D78396

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>




More information about the All-commits mailing list