[Lldb-commits] [PATCH] D78396: [lldb/Dataformatter] Add support for CoreFoundation Dictionaries and Sets

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 17 12:58:48 PDT 2020


mib created this revision.
mib added reviewers: friss, davide, jingham.
mib added a project: LLDB.
Herald added subscribers: lldb-commits, mgorny.
mib edited the summary of this revision.
mib updated this revision to Diff 258402.
mib added a comment.

Reformat patch.


[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 (D48450 <https://reviews.llvm.org/D48450>) 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 elements:

  (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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78396

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78396.258402.patch
Type: text/x-patch
Size: 36564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200417/46e8c4dc/attachment-0001.bin>


More information about the lldb-commits mailing list