[Lldb-commits] [lldb] r333465 - [ObjC] Fix the formatter for NSOrderedSet.

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed May 30 03:17:06 PDT 2018


I've added a @skipUnlessDarwin to the new test. Right now we don't
have the ability to build or run ObjC tests on other platforms.
On Tue, 29 May 2018 at 23:57, Davide Italiano via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
> I would like to apologize, I forgot to `git add `the Makefile and this
> broke the bots. It should be fixed now. I'll keep an eye to make sure
> everything stays green.
> Sorry for the disruption, folks!
>
> --
> Davide
>
> On Tue, May 29, 2018 at 3:08 PM, Davide Italiano via lldb-commits
> <lldb-commits at lists.llvm.org> wrote:
> > Author: davide
> > Date: Tue May 29 15:08:07 2018
> > New Revision: 333465
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=333465&view=rev
> > Log:
> > [ObjC] Fix the formatter for NSOrderedSet.
> >
> > While I'm here, delete some dead code.
> >
> > <rdar://problem/40622096>
> >
> > Added:
> >     lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/
> >     lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
> >     lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
> > Modified:
> >     lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
> >
> > Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py
> > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py?rev=333465&view=auto
> > ==============================================================================
> > --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py (added)
> > +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/TestOrderedSet.py Tue May 29 15:08:07 2018
> > @@ -0,0 +1,17 @@
> > +import lldb
> > +from lldbsuite.test.decorators import *
> > +from lldbsuite.test.lldbtest import *
> > +from lldbsuite.test import lldbutil
> > +
> > +class TestOrderedSet(TestBase):
> > +  mydir = TestBase.compute_mydir(__file__)
> > +
> > +  def test_ordered_set(self):
> > +    self.build()
> > +    src_file = "main.m"
> > +    src_file_spec = lldb.SBFileSpec(src_file)
> > +    (target, process, thread, main_breakpoint) = lldbutil.run_to_source_breakpoint(self,
> > +          "break here", src_file_spec, exe_name = "a.out")
> > +    frame = thread.GetSelectedFrame()
> > +    self.expect("expr -d run -- orderedSet", substrs=["3 elements"])
> > +    self.expect("expr -d run -- *orderedSet", substrs=["(int)1", "(int)2", "(int)3"])
> >
> > Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m
> > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m?rev=333465&view=auto
> > ==============================================================================
> > --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m (added)
> > +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/orderedset/main.m Tue May 29 15:08:07 2018
> > @@ -0,0 +1,8 @@
> > +#import <Foundation/Foundation.h>
> > +
> > +int main() {
> > +  NSOrderedSet *orderedSet =
> > +      [NSOrderedSet orderedSetWithArray:@[@1, at 2, at 3, at 1]];
> > +  NSLog(@"%@",orderedSet);
> > +  return 0; // break here
> > +}
> >
> > Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
> > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp?rev=333465&r1=333464&r2=333465&view=diff
> > ==============================================================================
> > --- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp (original)
> > +++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp Tue May 29 15:08:07 2018
> > @@ -269,7 +269,8 @@ bool lldb_private::formatters::NSSetSumm
> >    if (!class_name || !*class_name)
> >      return false;
> >
> > -  if (!strcmp(class_name, "__NSSetI")) {
> > +  if (!strcmp(class_name, "__NSSetI") ||
> > +      !strcmp(class_name, "__NSOrderedSetI")) {
> >      Status error;
> >      value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
> >                                                        ptr_size, 0, error);
> > @@ -289,32 +290,7 @@ bool lldb_private::formatters::NSSetSumm
> >      }
> >      if (error.Fail())
> >        return false;
> > -  }
> > -  /*else if (!strcmp(class_name,"__NSCFSet"))
> > -   {
> > -   Status error;
> > -   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ?
> > -   20 : 12), 4, 0, error);
> > -   if (error.Fail())
> > -   return false;
> > -   if (is_64bit)
> > -   value &= ~0x1fff000000000000UL;
> > -   }
> > -   else if (!strcmp(class_name,"NSCountedSet"))
> > -   {
> > -   Status error;
> > -   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
> > -   ptr_size, 0, error);
> > -   if (error.Fail())
> > -   return false;
> > -   value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 :
> > -   12), 4, 0, error);
> > -   if (error.Fail())
> > -   return false;
> > -   if (is_64bit)
> > -   value &= ~0x1fff000000000000UL;
> > -   }*/
> > -  else {
> > +  } else {
> >      auto &map(NSSet_Additionals::GetAdditionalSummaries());
> >      auto iter = map.find(class_name_cs), end = map.end();
> >      if (iter != end)
> > @@ -371,7 +347,8 @@ lldb_private::formatters::NSSetSynthetic
> >    if (!class_name || !*class_name)
> >      return nullptr;
> >
> > -  if (!strcmp(class_name, "__NSSetI")) {
> > +  if (!strcmp(class_name, "__NSSetI") ||
> > +      !strcmp(class_name, "__NSOrderedSetI")) {
> >      return (new NSSetISyntheticFrontEnd(valobj_sp));
> >    } else if (!strcmp(class_name, "__NSSetM")) {
> >      AppleObjCRuntime *apple_runtime =
> >
> >
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list