[Lldb-commits] [lldb] r161882 - in /lldb/trunk: source/Commands/CommandObjectType.cpp test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py

Enrico Granata egranata at apple.com
Tue Aug 14 11:18:07 PDT 2012


Author: enrico
Date: Tue Aug 14 13:18:07 2012
New Revision: 161882

URL: http://llvm.org/viewvc/llvm-project?rev=161882&view=rev
Log:
<rdar://problem/11589605> Making a 
'type category enable *' command
to match 'type category disable *'

Modified:
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=161882&r1=161881&r2=161882&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Tue Aug 14 13:18:07 2012
@@ -1956,24 +1956,46 @@
             return false;
         }
         
-        for (int i = argc - 1; i >= 0; i--)
+        if (argc == 1 && strcmp(command.GetArgumentAtIndex(0),"*") == 0)
         {
-            const char* typeA = command.GetArgumentAtIndex(i);
-            ConstString typeCS(typeA);
-            
-            if (!typeCS)
+            // we want to make sure to enable "system" last and "default" first
+            DataVisualization::Categories::Enable(ConstString("default"), CategoryMap::First);
+            uint32_t num_categories = DataVisualization::Categories::GetCount();
+            for (uint32_t i = 0; i < num_categories; i++)
             {
-                result.AppendError("empty category name not allowed");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
+                lldb::TypeCategoryImplSP category_sp = DataVisualization::Categories::GetCategoryAtIndex(i);
+                if (category_sp)
+                {
+                    if ( ::strcmp(category_sp->GetName(), "system") == 0 ||
+                         ::strcmp(category_sp->GetName(), "default") == 0 )
+                        continue;
+                    else
+                        DataVisualization::Categories::Enable(category_sp, CategoryMap::Default);
+                }
             }
-            DataVisualization::Categories::Enable(typeCS);
-            lldb::TypeCategoryImplSP cate;
-            if (DataVisualization::Categories::GetCategory(typeCS, cate) && cate.get())
+            DataVisualization::Categories::Enable(ConstString("system"), CategoryMap::Last);
+        }
+        else
+        {
+            for (int i = argc - 1; i >= 0; i--)
             {
-                if (cate->GetCount() == 0)
+                const char* typeA = command.GetArgumentAtIndex(i);
+                ConstString typeCS(typeA);
+                
+                if (!typeCS)
+                {
+                    result.AppendError("empty category name not allowed");
+                    result.SetStatus(eReturnStatusFailed);
+                    return false;
+                }
+                DataVisualization::Categories::Enable(typeCS);
+                lldb::TypeCategoryImplSP cate;
+                if (DataVisualization::Categories::GetCategory(typeCS, cate) && cate.get())
                 {
-                    result.AppendWarning("empty category enabled (typo?)");
+                    if (cate->GetCount() == 0)
+                    {
+                        result.AppendWarning("empty category enabled (typo?)");
+                    }
                 }
             }
         }

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py?rev=161882&r1=161881&r2=161882&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py Tue Aug 14 13:18:07 2012
@@ -83,7 +83,7 @@
         self.expect('type category list', substrs = ['system is not enabled', 'gnu-libstdc++ is not enabled', 'AppKit is not enabled'])
         
         # now enable and check that we are back to normal
-        cleanup()
+        self.runCmd("type category enable *")
 
         self.expect('type category list', substrs = ['system is enabled', 'gnu-libstdc++ is enabled', 'AppKit is enabled'])
 





More information about the lldb-commits mailing list