[Lldb-commits] [lldb] r137886 - in /lldb/trunk: examples/synthetic/ include/lldb/Core/ scripts/Python/ source/ source/Commands/ source/Core/ source/Interpreter/ test/functionalities/data-formatter/data-formatter-skip-summary/

Enrico Granata granata.enrico at gmail.com
Wed Aug 17 15:13:59 PDT 2011


Author: enrico
Date: Wed Aug 17 17:13:59 2011
New Revision: 137886

URL: http://llvm.org/viewvc/llvm-project?rev=137886&view=rev
Log:
First round of code cleanups:
 - all instances of "vobj" have been renamed to "valobj"
 - class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp)
   The interface to this class has not changed
 - FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting
   from ConstString to const char* and back all the time
   Next step is making the same happen for categories themselves
 - category gnu-libstdc++ is defined in the constructor for a FormatManager
   The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time
   All references to previous 'osxcpp' name have been removed from both code and file names
Functional changes:
 - the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string
   to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script
   will become -o

Added:
    lldb/trunk/examples/synthetic/gnu_libstdcpp.py
Removed:
    lldb/trunk/source/osxcpp.py
Modified:
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/include/lldb/Core/FormatClasses.h
    lldb/trunk/include/lldb/Core/FormatManager.h
    lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/trunk/source/Commands/CommandObjectFrame.cpp
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/FormatClasses.cpp
    lldb/trunk/source/Core/FormatManager.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/Interpreter/CommandObjectScript.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py

Added: lldb/trunk/examples/synthetic/gnu_libstdcpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/synthetic/gnu_libstdcpp.py?rev=137886&view=auto
==============================================================================
--- lldb/trunk/examples/synthetic/gnu_libstdcpp.py (added)
+++ lldb/trunk/examples/synthetic/gnu_libstdcpp.py Wed Aug 17 17:13:59 2011
@@ -0,0 +1,231 @@
+import re
+
+# C++ STL formatters for LLDB
+# These formatters are based upon the version of the STL that ships
+# with Mac OS X Snow Leopard 10.6.8 and OS X Lion 10.7.0
+# The STL implementation *might* change on other releases of Apple's
+# operating system and library infrastructure, and might be different on
+# other operating systems
+
+class StdListSynthProvider:
+
+	def __init__(self, valobj, dict):
+		self.valobj = valobj
+		self.update()
+
+	def num_children(self):
+		next_val = self.next.GetValueAsUnsigned(0)
+		prev_val = self.prev.GetValueAsUnsigned(0)
+		# After a std::list has been initialized, both next and prev will be non-NULL
+		if next_val == 0 or prev_val == 0:
+			return 0
+		if next_val == self.node_address:
+			return 0
+		if next_val == prev_val:
+			return 1
+		size = 2
+		current = self.next
+		while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
+			size = size + 1
+			current = current.GetChildMemberWithName('_M_next')
+		return (size - 1)
+
+	def get_child_index(self,name):
+		return int(name.lstrip('[').rstrip(']'))
+
+	def get_child_at_index(self,index):
+		if index >= self.num_children():
+			return None;
+		offset = index
+		current = self.next
+		while offset > 0:
+			current = current.GetChildMemberWithName('_M_next')
+			offset = offset - 1
+		return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
+
+	def extract_type_name(self,name):
+		self.type_name = name[16:]
+		index = 2
+		count_of_template = 1
+		while index < len(self.type_name):
+			if self.type_name[index] == '<':
+				count_of_template = count_of_template + 1
+			elif self.type_name[index] == '>':
+				count_of_template = count_of_template - 1
+			elif self.type_name[index] == ',' and count_of_template == 1:
+				self.type_name = self.type_name[:index]
+				break
+			index = index + 1
+		self.type_name_nospaces = self.type_name.replace(", ", ",")
+
+	def update(self):
+		impl = self.valobj.GetChildMemberWithName('_M_impl')
+		node = impl.GetChildMemberWithName('_M_node')
+		self.extract_type_name(impl.GetType().GetName())
+		self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
+		self.next = node.GetChildMemberWithName('_M_next')
+		self.prev = node.GetChildMemberWithName('_M_prev')
+		self.data_type = node.GetTarget().FindFirstType(self.type_name)
+		# tries to fight against a difference in formatting type names between gcc and clang
+		if self.data_type.IsValid() == False:
+			self.data_type = node.GetTarget().FindFirstType(self.type_name_nospaces)
+		self.data_size = self.data_type.GetByteSize()
+
+class StdVectorSynthProvider:
+
+	def __init__(self, valobj, dict):
+		self.valobj = valobj;
+		self.update()
+
+	def num_children(self):
+		start_val = self.start.GetValueAsUnsigned(0)
+		finish_val = self.finish.GetValueAsUnsigned(0)
+		end_val  = self.end.GetValueAsUnsigned(0)
+		# Before a vector has been constructed, it will contain bad values
+		# so we really need to be careful about the length we return since
+		# unitialized data can cause us to return a huge number. We need
+		# to also check for any of the start, finish or end of storage values
+		# being zero (NULL). If any are, then this vector has not been 
+		# initialized yet and we should return zero
+
+		# Make sure nothing is NULL
+		if start_val == 0 or finish_val == 0 or end_val == 0:
+			return 0
+		# Make sure start is less than finish
+		if start_val >= finish_val:
+			return 0
+		# Make sure finish is less than or equal to end of storage
+		if finish_val > end_val:
+			return 0
+
+		num_children = (finish_val-start_val)/self.data_size
+		return num_children
+
+	def get_child_index(self,name):
+		return int(name.lstrip('[').rstrip(']'))
+
+	def get_child_at_index(self,index):
+		if index >= self.num_children():
+			return None;
+		offset = index * self.data_size
+		return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
+
+	def update(self):
+		impl = self.valobj.GetChildMemberWithName('_M_impl')
+		self.start = impl.GetChildMemberWithName('_M_start')
+		self.finish = impl.GetChildMemberWithName('_M_finish')
+		self.end = impl.GetChildMemberWithName('_M_end_of_storage')
+		self.data_type = self.start.GetType().GetPointeeType()
+		self.data_size = self.data_type.GetByteSize()
+
+
+class StdMapSynthProvider:
+
+	def __init__(self, valobj, dict):
+		self.valobj = valobj;
+		self.update()
+
+	def update(self):
+		self.Mt = self.valobj.GetChildMemberWithName('_M_t')
+		self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
+		self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header')
+		# from libstdc++ implementation of _M_root for rbtree
+		self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
+		# the stuff into the tree is actually a std::pair<const key, value>
+		# life would be much easier if gcc had a coherent way to print out
+		# template names in debug info
+		self.expand_clang_type_name()
+		self.expand_gcc_type_name()
+		self.data_type = self.Mt.GetTarget().FindFirstType(self.clang_type_name)
+		if self.data_type.IsValid() == False:
+			self.data_type = self.Mt.GetTarget().FindFirstType(self.gcc_type_name)
+		self.data_size = self.data_type.GetByteSize()
+		self.skip_size = self.Mheader.GetType().GetByteSize()
+
+	def expand_clang_type_name(self):
+		type_name = self.Mimpl.GetType().GetName()
+		index = type_name.find("std::pair<")
+		type_name = type_name[index+5:]
+		index = 6
+		template_count = 1
+		while index < len(type_name):
+			if type_name[index] == '<':
+				template_count = template_count + 1
+			elif type_name[index] == '>' and template_count == 1:
+				type_name = type_name[:index+1]
+				break
+			elif type_name[index] == '>':
+				template_count = template_count - 1
+			index = index + 1;
+		self.clang_type_name = type_name
+
+	def expand_gcc_type_name(self):
+		type_name = self.Mt.GetType().GetName()
+		index = type_name.find("std::pair<")
+		type_name = type_name[index+5:]
+		index = 6
+		template_count = 1
+		while index < len(type_name):
+			if type_name[index] == '<':
+				template_count = template_count + 1
+			elif type_name[index] == '>' and template_count == 1:
+				type_name = type_name[:index+1]
+				break
+			elif type_name[index] == '>':
+				template_count = template_count - 1
+			elif type_name[index] == ' ' and template_count == 1 and type_name[index-1] == ',':
+			    type_name = type_name[0:index] + type_name[index+1:]
+			    index = index - 1
+			index = index + 1;
+		self.gcc_type_name = type_name
+
+	def num_children(self):
+		root_ptr_val = self.node_ptr_value(self.Mroot)
+		if root_ptr_val == 0:
+			return 0;
+		return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
+
+	def get_child_index(self,name):
+		return int(name.lstrip('[').rstrip(']'))
+
+	def get_child_at_index(self,index):
+		if index >= self.num_children():
+			return None;
+		offset = index
+		current = self.left(self.Mheader);
+		while offset > 0:
+			current = self.increment_node(current)
+			offset = offset - 1;
+		# skip all the base stuff and get at the data
+		return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
+
+	# utility functions
+	def node_ptr_value(self,node):
+		return node.GetValueAsUnsigned(0)
+
+	def right(self,node):
+		return node.GetChildMemberWithName("_M_right");
+
+	def left(self,node):
+		return node.GetChildMemberWithName("_M_left");
+
+	def parent(self,node):
+		return node.GetChildMemberWithName("_M_parent");
+
+	# from libstdc++ implementation of iterator for rbtree
+	def increment_node(self,node):
+		if self.node_ptr_value(self.right(node)) != 0:
+			x = self.right(node);
+			while self.node_ptr_value(self.left(x)) != 0:
+				x = self.left(x);
+			return x;
+		else:
+			x = node;
+			y = self.parent(x)
+			while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))):
+				x = y;
+				y = self.parent(y);
+			if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y):
+				x = y;
+			return x;
+

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Wed Aug 17 17:13:59 2011
@@ -271,12 +271,6 @@
     SettingsTerminate ();
     
     static void
-    FormatManagerInitialize();
-    
-    static void
-    FormatManagerTerminate();
-    
-    static void
     Destroy (lldb::DebuggerSP &debugger_sp);
 
     ~Debugger ();
@@ -422,7 +416,7 @@
                   const Address *addr,
                   Stream &s,
                   const char **end,
-                  ValueObject* vobj = NULL);
+                  ValueObject* valobj = NULL);
 
 
     void
@@ -478,117 +472,6 @@
 
     DISALLOW_COPY_AND_ASSIGN (Debugger);
     
-public:
-    
-    class Formatting
-    {
-    public:
-        
-        // use this call to force the FM to consider itself updated even when there is no apparent reason for that
-        static void
-        ForceUpdate();
-        
-        class ValueFormats
-        {
-        public:
-            static bool
-            Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry);
-            
-            static void
-            Add(const ConstString &type, const ValueFormat::SharedPointer &entry);
-            
-            static bool
-            Delete(const ConstString &type);
-            
-            static void
-            Clear();
-            
-            static void
-            LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton);
-            
-            static uint32_t
-            GetCurrentRevision();
-            
-            static uint32_t
-            GetCount();
-        };
-
-        static bool
-        GetSummaryFormat(ValueObject& vobj,
-                         lldb::DynamicValueType use_dynamic,
-                         lldb::SummaryFormatSP& entry);
-        static bool
-        GetSyntheticChildren(ValueObject& vobj,
-                             lldb::DynamicValueType use_dynamic,
-                             lldb::SyntheticChildrenSP& entry);
-        
-        static bool
-        AnyMatches(ConstString type_name,
-                   FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
-                   bool only_enabled = true,
-                   const char** matching_category = NULL,
-                   FormatCategory::FormatCategoryItems* matching_type = NULL);
-        
-        class NamedSummaryFormats
-        {
-        public:
-            static bool
-            Get(const ConstString &type, SummaryFormat::SharedPointer &entry);
-            
-            static void
-            Add(const ConstString &type, const SummaryFormat::SharedPointer &entry);
-            
-            static bool
-            Delete(const ConstString &type);
-            
-            static void
-            Clear();
-            
-            static void
-            LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton);
-            
-            static uint32_t
-            GetCurrentRevision();
-            
-            static uint32_t
-            GetCount();
-        };
-                
-        class Categories
-        {
-        public:
-            
-            static bool
-            Get(const ConstString &category, lldb::FormatCategorySP &entry);
-            
-            static void
-            Add(const ConstString &category);
-            
-            static bool
-            Delete(const ConstString &category);
-            
-            static void
-            Clear();
-            
-            static void
-            Clear(ConstString &category);
-            
-            static void
-            Enable(ConstString& category);
-            
-            static void
-            Disable(ConstString& category);
-            
-            static void
-            LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton);
-            
-            static uint32_t
-            GetCurrentRevision();
-            
-            static uint32_t
-            GetCount();
-        };
-    };
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Core/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatClasses.h?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/Core/FormatClasses.h Wed Aug 17 17:13:59 2011
@@ -57,7 +57,7 @@
     }
     
     typedef lldb::SharedPtr<ValueFormat>::Type SharedPointer;
-    typedef bool(*ValueCallback)(void*, const char*, const ValueFormat::SharedPointer&);
+    typedef bool(*ValueCallback)(void*, ConstString, const ValueFormat::SharedPointer&);
     
     ~ValueFormat()
     {
@@ -169,7 +169,7 @@
     GetFrontEnd(lldb::ValueObjectSP backend) = 0;
     
     typedef lldb::SharedPtr<SyntheticChildren>::Type SharedPointer;
-    typedef bool(*SyntheticChildrenCallback)(void*, const char*, const SyntheticChildren::SharedPointer&);
+    typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
     
 };
 
@@ -453,7 +453,7 @@
     GetDescription() = 0;
     
     typedef lldb::SharedPtr<SummaryFormat>::Type SharedPointer;
-    typedef bool(*SummaryCallback)(void*, const char*, const SummaryFormat::SharedPointer&);
+    typedef bool(*SummaryCallback)(void*, ConstString, const SummaryFormat::SharedPointer&);
     typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const SummaryFormat::SharedPointer&);
     
 };

Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Wed Aug 17 17:13:59 2011
@@ -227,23 +227,23 @@
         m_format_map.Add(type,entry);
     }
     
-    // using const char* instead of MapKeyType is necessary here
+    // using ConstString instead of MapKeyType is necessary here
     // to make the partial template specializations below work
     bool
-    Delete(const char *type)
+    Delete(ConstString type)
     {
         return m_format_map.Delete(type);
     }
         
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         MapValueType& entry,
         lldb::DynamicValueType use_dynamic,
         uint32_t* why = NULL)
     {
         uint32_t value = lldb::eFormatterChoiceCriterionDirectChoice;
-        clang::QualType type = clang::QualType::getFromOpaquePtr(vobj.GetClangType());
-        bool ret = Get(vobj, type, entry, use_dynamic, value);
+        clang::QualType type = clang::QualType::getFromOpaquePtr(valobj.GetClangType());
+        bool ret = Get(valobj, type, entry, use_dynamic, value);
         if (ret)
             entry = MapValueType(entry);
         else
@@ -277,15 +277,15 @@
     
     ConstString m_id_cs;
     
-    // using const char* instead of MapKeyType is necessary here
+    // using ConstString instead of MapKeyType is necessary here
     // to make the partial template specializations below work
     bool
-    Get(const char* type, MapValueType& entry)
+    Get(ConstString type, MapValueType& entry)
     {
         return m_format_map.Get(type, entry);
     }
     
-    bool Get_ObjC(ValueObject& vobj,
+    bool Get_ObjC(ValueObject& valobj,
              ObjCLanguageRuntime::ObjCISA isa,
              MapValueType& entry,
              uint32_t& reason)
@@ -293,7 +293,7 @@
         LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
         if (log)
             log->Printf("going to an Objective-C dynamic scanning");
-        Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+        Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
         ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
         if (runtime == NULL)
         {
@@ -310,7 +310,7 @@
         ConstString name = runtime->GetActualTypeName(isa);
         if (log)
             log->Printf("looking for formatter for %s", name.GetCString());
-        if (Get(name.GetCString(), entry))
+        if (Get(name, entry))
         {
             if (log)
                 log->Printf("direct match found, returning");
@@ -331,7 +331,7 @@
                 log->Printf("parent-child loop, bailing out");
             return false;
         }
-        if (Get_ObjC(vobj, parent, entry, reason))
+        if (Get_ObjC(valobj, parent, entry, reason))
         {
             reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
             return true;
@@ -339,7 +339,7 @@
         return false;
     }
     
-    bool Get(ValueObject& vobj,
+    bool Get(ValueObject& valobj,
              clang::QualType type,
              MapValueType& entry,
              lldb::DynamicValueType use_dynamic,
@@ -361,17 +361,16 @@
                 log->Printf("type is NULL, returning");
             return false;
         }
-        ConstString name(ClangASTType::GetTypeNameForQualType(type).c_str());
-        const char* typeName = name.GetCString();
-        if (vobj.GetBitfieldBitSize() > 0)
+        ConstString typeName(ClangASTType::GetTypeNameForQualType(type).c_str());
+        if (valobj.GetBitfieldBitSize() > 0)
         {
             // for bitfields, append size to the typename so one can custom format them
             StreamString sstring;
-            sstring.Printf("%s:%d",typeName,vobj.GetBitfieldBitSize());
+            sstring.Printf("%s:%d",typeName.AsCString(),valobj.GetBitfieldBitSize());
             ConstString bitfieldname = ConstString(sstring.GetData());
             if (log)
                 log->Printf("appended bitfield info, final result is %s", bitfieldname.GetCString());
-            if (Get(bitfieldname.AsCString(), entry))
+            if (Get(bitfieldname, entry))
             {
                 if (log)
                     log->Printf("bitfield direct match found, returning");
@@ -387,8 +386,8 @@
         if (log)
             log->Printf("trying to get %s for VO name %s of type %s",
                         m_name.c_str(),
-                        vobj.GetName().AsCString(),
-                        typeName);
+                        valobj.GetName().AsCString(),
+                        typeName.AsCString());
         if (Get(typeName, entry))
         {
             if (log)
@@ -402,7 +401,7 @@
         {
             if (log)
                 log->Printf("stripping reference");
-            if (Get(vobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
+            if (Get(valobj,type.getNonReferenceType(),entry, use_dynamic, reason) && !entry->m_skip_references)
             {
                 reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
                 return true;
@@ -410,11 +409,11 @@
         }
         if (use_dynamic != lldb::eNoDynamicValues &&
             (/*strstr(typeName, "id") == typeName ||*/
-             ClangASTType::GetMinimumLanguage(vobj.GetClangAST(), vobj.GetClangType()) == lldb::eLanguageTypeObjC))
+             ClangASTType::GetMinimumLanguage(valobj.GetClangAST(), valobj.GetClangType()) == lldb::eLanguageTypeObjC))
         {
             if (log)
                 log->Printf("this is an ObjC 'id', let's do dynamic search");
-            Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+            Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
             ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
             if (runtime == NULL)
             {
@@ -423,7 +422,7 @@
             }
             else
             {
-                if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
+                if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
                 {
                     reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
                     return true;
@@ -433,7 +432,7 @@
         else if (use_dynamic != lldb::eNoDynamicValues && log)
         {
             log->Printf("typename: %s, typePtr = %p, id = %p",
-                        name.AsCString(), typePtr, vobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
+                        typeName.AsCString(), typePtr, valobj.GetClangAST()->ObjCBuiltinIdTy.getTypePtr());
         }
         else if (log)
         {
@@ -444,7 +443,7 @@
             if (log)
                 log->Printf("stripping pointer");
             clang::QualType pointee = typePtr->getPointeeType();
-            if (Get(vobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
+            if (Get(valobj, pointee, entry, use_dynamic, reason) && !entry->m_skip_pointers)
             {
                 reason |= lldb::eFormatterChoiceCriterionStrippedPointerReference;
                 return true;
@@ -453,11 +452,11 @@
         if (typePtr->isObjCObjectPointerType())
         {
             if (use_dynamic != lldb::eNoDynamicValues &&
-                name.GetCString() == m_id_cs.GetCString())
+                typeName == m_id_cs)
             {
                 if (log)
                     log->Printf("this is an ObjC 'id', let's do dynamic search");
-                Process* process = vobj.GetUpdatePoint().GetProcessSP().get();
+                Process* process = valobj.GetUpdatePoint().GetProcessSP().get();
                 ObjCLanguageRuntime* runtime = process->GetObjCLanguageRuntime();
                 if (runtime == NULL)
                 {
@@ -466,7 +465,7 @@
                 }
                 else
                 {
-                    if (Get_ObjC(vobj, runtime->GetISA(vobj), entry, reason))
+                    if (Get_ObjC(valobj, runtime->GetISA(valobj), entry, reason))
                     {
                         reason |= lldb::eFormatterChoiceCriterionDynamicObjCHierarchy;
                         return true;
@@ -482,7 +481,7 @@
             // the VO refers to a pointer-to- at interface
 
             Error error;
-            ValueObject* target = vobj.Dereference(error).get();
+            ValueObject* target = valobj.Dereference(error).get();
             if (error.Fail() || !target)
                 return false;
             if (Get(*target, typePtr->getPointeeType(), entry, use_dynamic, reason) && !entry->m_skip_pointers)
@@ -496,8 +495,8 @@
         {
             if (log)
                 log->Printf("working with ObjC");
-            clang::ASTContext *ast = vobj.GetClangAST();
-            if (ClangASTContext::GetCompleteType(ast, vobj.GetClangType()) && !objc_class_type->isObjCId())
+            clang::ASTContext *ast = valobj.GetClangAST();
+            if (ClangASTContext::GetCompleteType(ast, valobj.GetClangType()) && !objc_class_type->isObjCId())
             {
                 clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface();
                 if (class_interface_decl)
@@ -510,7 +509,7 @@
                         if (log)
                             log->Printf("got a parent class for this ObjC class");
                         clang::QualType ivar_qual_type(ast->getObjCInterfaceType(superclass_interface_decl));
-                        if (Get(vobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
+                        if (Get(valobj, ivar_qual_type, entry, use_dynamic, reason) && entry->m_cascades)
                         {
                             reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
                             return true;
@@ -528,7 +527,7 @@
             if (record)
             {
                 if (!record->hasDefinition())
-                    ClangASTContext::GetCompleteType(vobj.GetClangAST(), vobj.GetClangType());
+                    ClangASTContext::GetCompleteType(valobj.GetClangAST(), valobj.GetClangType());
                 if (record->hasDefinition())
                 {
                     clang::CXXRecordDecl::base_class_iterator pos,end;
@@ -539,7 +538,7 @@
                         end = record->bases_end();
                         for (pos = record->bases_begin(); pos != end; pos++)
                         {
-                            if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
+                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
                             {
                                 reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
                                 return true;
@@ -553,7 +552,7 @@
                         end = record->vbases_end();
                         for (pos = record->vbases_begin(); pos != end; pos++)
                         {
-                            if ((Get(vobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
+                            if ((Get(valobj, pos->getType(), entry, use_dynamic, reason)) && entry->m_cascades)
                             {
                                 reason |= lldb::eFormatterChoiceCriterionNavigatedBaseClasses;
                                 return true;
@@ -569,7 +568,7 @@
         {
             if (log)
                 log->Printf("stripping typedef");
-            if ((Get(vobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
+            if ((Get(valobj, type_tdef->getDecl()->getUnderlyingType(), entry, use_dynamic, reason)) && entry->m_cascades)
             {
                 reason |= lldb::eFormatterChoiceCriterionNavigatedTypedefs;
                 return true;
@@ -581,27 +580,27 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key, SummaryFormat::SharedPointer& value);
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(ConstString key, SummaryFormat::SharedPointer& value);
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* type);
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(ConstString type);
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key, SyntheticFilter::SharedPointer& value);
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(ConstString key, SyntheticFilter::SharedPointer& value);
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char* type);
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(ConstString type);
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const char* key, SyntheticFilter::SharedPointer& value);
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(ConstString key, SyntheticFilter::SharedPointer& value);
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(const char* type);
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(ConstString type);
     
 class CategoryMap;
     
@@ -609,13 +608,13 @@
 {
 private:
     
-    typedef FormatNavigator<const char*, SummaryFormat> SummaryNavigator;
+    typedef FormatNavigator<ConstString, SummaryFormat> SummaryNavigator;
     typedef FormatNavigator<lldb::RegularExpressionSP, SummaryFormat> RegexSummaryNavigator;
     
-    typedef FormatNavigator<const char*, SyntheticFilter> FilterNavigator;
+    typedef FormatNavigator<ConstString, SyntheticFilter> FilterNavigator;
     typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter> RegexFilterNavigator;
     
-    typedef FormatNavigator<const char*, SyntheticScriptProvider> SynthNavigator;
+    typedef FormatNavigator<ConstString, SyntheticScriptProvider> SynthNavigator;
     typedef FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider> RegexSynthNavigator;
 
     typedef SummaryNavigator::MapType SummaryMap;
@@ -657,13 +656,13 @@
     
     friend class CategoryMap;
     
-    friend class FormatNavigator<const char*, SummaryFormat>;
+    friend class FormatNavigator<ConstString, SummaryFormat>;
     friend class FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>;
 
-    friend class FormatNavigator<const char*, SyntheticFilter>;
+    friend class FormatNavigator<ConstString, SyntheticFilter>;
     friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>;
 
-    friend class FormatNavigator<const char*, SyntheticScriptProvider>;
+    friend class FormatNavigator<ConstString, SyntheticScriptProvider>;
     friend class FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>;
     
 public:
@@ -745,23 +744,23 @@
     }
         
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SummaryFormatSP& entry,
         lldb::DynamicValueType use_dynamic,
         uint32_t* reason = NULL)
     {
         if (!IsEnabled())
             return false;
-        if (Summary()->Get(vobj, entry, use_dynamic, reason))
+        if (Summary()->Get(valobj, entry, use_dynamic, reason))
             return true;
-        bool regex = RegexSummary()->Get(vobj, entry, use_dynamic, reason);
+        bool regex = RegexSummary()->Get(valobj, entry, use_dynamic, reason);
         if (regex && reason)
             *reason |= lldb::eFormatterChoiceCriterionRegularExpressionSummary;
         return regex;
     }
     
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SyntheticChildrenSP& entry,
         lldb::DynamicValueType use_dynamic,
         uint32_t* reason = NULL)
@@ -778,11 +777,11 @@
         
         // first find both Filter and Synth, and then check which is most recent
         
-        if (!Filter()->Get(vobj, filter, use_dynamic, &reason_filter))
-            regex_filter = RegexFilter()->Get(vobj, filter, use_dynamic, &reason_filter);
+        if (!Filter()->Get(valobj, filter, use_dynamic, &reason_filter))
+            regex_filter = RegexFilter()->Get(valobj, filter, use_dynamic, &reason_filter);
         
-        if (!Synth()->Get(vobj, synth, use_dynamic, &reason_synth))
-            regex_synth = RegexSynth()->Get(vobj, synth, use_dynamic, &reason_synth);
+        if (!Synth()->Get(valobj, synth, use_dynamic, &reason_synth))
+            regex_synth = RegexSynth()->Get(valobj, synth, use_dynamic, &reason_synth);
         
         if (!filter.get() && !synth.get())
             return false;
@@ -826,7 +825,7 @@
     
     // just a shortcut for (Summary()->Delete(name) || RegexSummary()->Delete(name))
     bool
-    DeleteSummaries(const char* name)
+    DeleteSummaries(ConstString name)
     {
         return Delete(name, (eSummary | eRegexSummary));
     }
@@ -850,7 +849,7 @@
     }
     
     bool
-    Delete(const char* name,
+    Delete(ConstString name,
            FormatCategoryItems items = ALL_ITEM_TYPES)
     {
         bool success = false;
@@ -910,7 +909,7 @@
         
         if ( (items & eSummary) == eSummary )
         {
-            if (m_summary_nav->Get(type_name.AsCString(), summary))
+            if (m_summary_nav->Get(type_name, summary))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -921,7 +920,7 @@
         }
         if ( (items & eRegexSummary) == eRegexSummary )
         {
-            if (m_regex_summary_nav->Get(type_name.AsCString(), summary))
+            if (m_regex_summary_nav->Get(type_name, summary))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -932,7 +931,7 @@
         }
         if ( (items & eFilter)  == eFilter )
         {
-            if (m_filter_nav->Get(type_name.AsCString(), filter))
+            if (m_filter_nav->Get(type_name, filter))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -943,7 +942,7 @@
         }
         if ( (items & eRegexFilter) == eRegexFilter )
         {
-            if (m_regex_filter_nav->Get(type_name.AsCString(), filter))
+            if (m_regex_filter_nav->Get(type_name, filter))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -954,7 +953,7 @@
         }
         if ( (items & eSynth)  == eSynth )
         {
-            if (m_synth_nav->Get(type_name.AsCString(), synth))
+            if (m_synth_nav->Get(type_name, synth))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -965,7 +964,7 @@
         }
         if ( (items & eRegexSynth) == eRegexSynth )
         {
-            if (m_regex_synth_nav->Get(type_name.AsCString(), synth))
+            if (m_regex_synth_nav->Get(type_name, synth))
             {
                 if (matching_category)
                     *matching_category = m_name.c_str();
@@ -1175,7 +1174,7 @@
     }
     
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SummaryFormatSP& entry,
         lldb::DynamicValueType use_dynamic)
     {
@@ -1188,7 +1187,7 @@
         {
             FormatCategory::SharedPointer category = *begin;
             lldb::SummaryFormatSP current_format;
-            if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
+            if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
                 continue;
             /*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
              {
@@ -1207,7 +1206,7 @@
     }
     
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SyntheticChildrenSP& entry,
         lldb::DynamicValueType use_dynamic)
     {
@@ -1221,7 +1220,7 @@
         {
             FormatCategory::SharedPointer category = *begin;
             lldb::SyntheticChildrenSP current_format;
-            if (!category->Get(vobj, current_format, use_dynamic, &reason_why))
+            if (!category->Get(valobj, current_format, use_dynamic, &reason_why))
                 continue;
             /*if (reason_why == lldb::eFormatterChoiceCriterionDirectChoice)
             {
@@ -1246,10 +1245,10 @@
 {
 private:
     
-    typedef FormatNavigator<const char*, ValueFormat> ValueNavigator;
+    typedef FormatNavigator<ConstString, ValueFormat> ValueNavigator;
 
     typedef ValueNavigator::MapType ValueMap;
-    typedef FormatMap<const char*, SummaryFormat> NamedSummariesMap;
+    typedef FormatMap<ConstString, SummaryFormat> NamedSummariesMap;
         
     ValueNavigator m_value_nav;
     NamedSummariesMap m_named_summaries_map;
@@ -1258,68 +1257,19 @@
     
     const char* m_default_category_name;
     const char* m_system_category_name;
+    const char* m_gnu_cpp_category_name;
         
     typedef CategoryMap::MapType::iterator CategoryMapIterator;
     
     ConstString m_default_cs;
     ConstString m_system_cs;
-    ConstString m_charstar_cs;
-    ConstString m_constcharstar_cs;
+    ConstString m_gnu_stdcpp_cs;
 
 public:
     
     typedef bool (*CategoryCallback)(void*, const char*, const FormatCategory::SharedPointer&);
     
-    FormatManager() : 
-    m_value_nav("format",this),
-    m_named_summaries_map(this),
-    m_last_revision(0),
-    m_categories_map(this),
-    m_default_cs(ConstString("default")),
-    m_system_cs(ConstString("system")), 
-    m_charstar_cs(ConstString("char *")),
-    m_constcharstar_cs(ConstString("const char *"))
-    {
-        
-        // build default categories
-        
-        m_default_category_name = m_default_cs.GetCString();
-        m_system_category_name = m_system_cs.GetCString();
-
-        // add some default stuff
-        // most formats, summaries, ... actually belong to the users' lldbinit file rather than here
-        SummaryFormat::SharedPointer string_format(new StringSummaryFormat(false,
-                                                                           true,
-                                                                           false,
-                                                                           true,
-                                                                           false,
-                                                                           false,
-                                                                           "${var%s}"));
-        
-        
-        SummaryFormat::SharedPointer string_array_format(new StringSummaryFormat(false,
-                                                                                 true,
-                                                                                 false,
-                                                                                 false,
-                                                                                 false,
-                                                                                 false,
-                                                                                 "${var%s}"));
-        
-        lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
-        
-        
-        Category(m_system_category_name)->Summary()->Add(m_charstar_cs.GetCString(), string_format);
-        Category(m_system_category_name)->Summary()->Add(m_constcharstar_cs.GetCString(), string_format);
-        Category(m_system_category_name)->RegexSummary()->Add(any_size_char_arr, string_array_format);
-        
-        Category(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
-        
-        // the order of these two calls IS important, if you invert it "system" summaries will prevail over the user's
-        EnableCategory(m_system_category_name);
-        EnableCategory(m_default_category_name);
-        
-    }
-
+    FormatManager();
     
     CategoryMap& Categories() { return m_categories_map; }
     ValueNavigator& Value() { return m_value_nav; }
@@ -1368,18 +1318,18 @@
     }
     
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SummaryFormatSP& entry,
         lldb::DynamicValueType use_dynamic)
     {
-        return m_categories_map.Get(vobj, entry, use_dynamic);
+        return m_categories_map.Get(valobj, entry, use_dynamic);
     }
     bool
-    Get(ValueObject& vobj,
+    Get(ValueObject& valobj,
         lldb::SyntheticChildrenSP& entry,
         lldb::DynamicValueType use_dynamic)
     {
-        return m_categories_map.Get(vobj, entry, use_dynamic);
+        return m_categories_map.Get(valobj, entry, use_dynamic);
     }
     
     bool
@@ -1430,6 +1380,117 @@
 
 };
 
+class DataVisualization
+{
+public:
+    
+    // use this call to force the FM to consider itself updated even when there is no apparent reason for that
+    static void
+    ForceUpdate();
+    
+    class ValueFormats
+    {
+    public:
+        static bool
+        Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry);
+        
+        static void
+        Add(const ConstString &type, const ValueFormat::SharedPointer &entry);
+        
+        static bool
+        Delete(const ConstString &type);
+        
+        static void
+        Clear();
+        
+        static void
+        LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCurrentRevision();
+        
+        static uint32_t
+        GetCount();
+    };
+    
+    static bool
+    GetSummaryFormat(ValueObject& valobj,
+                     lldb::DynamicValueType use_dynamic,
+                     lldb::SummaryFormatSP& entry);
+    static bool
+    GetSyntheticChildren(ValueObject& valobj,
+                         lldb::DynamicValueType use_dynamic,
+                         lldb::SyntheticChildrenSP& entry);
+    
+    static bool
+    AnyMatches(ConstString type_name,
+               FormatCategory::FormatCategoryItems items = FormatCategory::ALL_ITEM_TYPES,
+               bool only_enabled = true,
+               const char** matching_category = NULL,
+               FormatCategory::FormatCategoryItems* matching_type = NULL);
+    
+    class NamedSummaryFormats
+    {
+    public:
+        static bool
+        Get(const ConstString &type, lldb::SummaryFormatSP &entry);
+        
+        static void
+        Add(const ConstString &type, const lldb::SummaryFormatSP &entry);
+        
+        static bool
+        Delete(const ConstString &type);
+        
+        static void
+        Clear();
+        
+        static void
+        LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCurrentRevision();
+        
+        static uint32_t
+        GetCount();
+    };
+    
+    class Categories
+    {
+    public:
+        
+        static bool
+        Get(const ConstString &category, lldb::FormatCategorySP &entry);
+        
+        static void
+        Add(const ConstString &category);
+        
+        static bool
+        Delete(const ConstString &category);
+        
+        static void
+        Clear();
+        
+        static void
+        Clear(ConstString &category);
+        
+        static void
+        Enable(ConstString& category);
+        
+        static void
+        Disable(ConstString& category);
+        
+        static void
+        LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton);
+        
+        static uint32_t
+        GetCurrentRevision();
+        
+        static uint32_t
+        GetCount();
+    };
+};
+
+    
 } // namespace lldb_private
 
 #endif	// lldb_FormatManager_h_

Modified: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Wed Aug 17 17:13:59 2011
@@ -165,18 +165,18 @@
     fi
 fi
 
-# Copy the OSX C++ STL formatters over to the framework Python directory
-if [ -f "${SRC_ROOT}/source/osxcpp.py" ]
+# Copy the C++ STL formatters over to the framework Python directory
+if [ -f "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" ]
 then
     if [ $Debug == 1 ]
     then
-        echo "Copying osxcpp.py to ${framework_python_dir}"
+        echo "Copying gnu_libstdcpp.py to ${framework_python_dir}"
     fi
-    cp "${SRC_ROOT}/source/osxcpp.py" "${framework_python_dir}"
+    cp "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" "${framework_python_dir}"
 else
     if [ $Debug == 1 ]
     then
-        echo "Unable to find ${SRC_ROOT}/source/osxcpp.py"
+        echo "Unable to find ${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py"
     fi
 fi
 

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Wed Aug 17 17:13:59 2011
@@ -14,6 +14,7 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/FormatManager.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/Timer.h"
@@ -441,7 +442,7 @@
             
             SummaryFormatSP summary_format_sp;
             if (!m_option_variable.summary.empty())
-                Debugger::Formatting::NamedSummaryFormats::Get(ConstString(m_option_variable.summary.c_str()), summary_format_sp);
+                DataVisualization::NamedSummaryFormats::Get(ConstString(m_option_variable.summary.c_str()), summary_format_sp);
             
             ValueObject::DumpValueObjectOptions options;
             

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Wed Aug 17 17:13:59 2011
@@ -199,7 +199,7 @@
             const char* typeA = command.GetArgumentAtIndex(i);
             ConstString typeCS(typeA);
             if (typeCS)
-                Debugger::Formatting::ValueFormats::Add(typeCS, entry);
+                DataVisualization::ValueFormats::Add(typeCS, entry);
             else
             {
                 result.AppendError("empty typenames not allowed");
@@ -276,7 +276,7 @@
         }
         
         
-        if (Debugger::Formatting::ValueFormats::Delete(typeCS))
+        if (DataVisualization::ValueFormats::Delete(typeCS))
         {
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
             return result.Succeeded();
@@ -314,7 +314,7 @@
     bool
     Execute (Args& command, CommandReturnObject &result)
     {
-        Debugger::Formatting::ValueFormats::Clear();
+        DataVisualization::ValueFormats::Clear();
         result.SetStatus(eReturnStatusSuccessFinishResult);
         return result.Succeeded();
     }
@@ -325,7 +325,7 @@
 // CommandObjectTypeFormatList
 //-------------------------------------------------------------------------
 
-bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, const char* type, const ValueFormat::SharedPointer& entry);
+bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const ValueFormat::SharedPointer& entry);
 
 class CommandObjectTypeFormatList;
 
@@ -375,7 +375,7 @@
         }
         else
             param = new CommandObjectTypeFormatList_LoopCallbackParam(this,&result);
-        Debugger::Formatting::ValueFormats::LoopThrough(CommandObjectTypeFormatList_LoopCallback, param);
+        DataVisualization::ValueFormats::LoopThrough(CommandObjectTypeFormatList_LoopCallback, param);
         delete param;
         result.SetStatus(eReturnStatusSuccessFinishResult);
         return result.Succeeded();
@@ -384,14 +384,14 @@
 private:
     
     bool
-    LoopCallback (const char* type,
+    LoopCallback (ConstString type,
                   const ValueFormat::SharedPointer& entry,
                   RegularExpression* regex,
                   CommandReturnObject *result)
     {
-        if (regex == NULL || regex->Execute(type)) 
+        if (regex == NULL || regex->Execute(type.AsCString())) 
         {
-            result->GetOutputStream().Printf ("%s: %s%s%s%s\n", type, 
+            result->GetOutputStream().Printf ("%s: %s%s%s%s\n", type.AsCString(), 
                                               FormatManager::GetFormatAsCString (entry->m_format),
                                               entry->m_cascades ? "" : " (not cascading)",
                                               entry->m_skip_pointers ? " (skip pointers)" : "",
@@ -400,14 +400,14 @@
         return true;
     }
     
-    friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, const char* type, const ValueFormat::SharedPointer& entry);
+    friend bool CommandObjectTypeFormatList_LoopCallback(void* pt2self, ConstString type, const ValueFormat::SharedPointer& entry);
     
 };
 
 bool
 CommandObjectTypeFormatList_LoopCallback (
                                     void* pt2self,
-                                    const char* type,
+                                    ConstString type,
                                     const ValueFormat::SharedPointer& entry)
 {
     CommandObjectTypeFormatList_LoopCallbackParam* param = (CommandObjectTypeFormatList_LoopCallbackParam*)pt2self;
@@ -971,23 +971,23 @@
                 "};\n"
                 "AnotherDemo *another_object = new AnotherDemo('E',42,3.14);\n"
                 "\n"
-                "type summary add -f \"the answer is ${*var.ptr}\" JustADemo\n"
+                "type summary add --summary-string \"the answer is ${*var.ptr}\" JustADemo\n"
                 "when typing frame variable object you will get \"the answer is 42\"\n"
-                "type summary add -f \"the answer is ${*var.ptr}, and the question is ${var.value}\" JustADemo\n"
+                "type summary add --summary-string \"the answer is ${*var.ptr}, and the question is ${var.value}\" JustADemo\n"
                 "when typing frame variable object you will get \"the answer is 42 and the question is 3.14\"\n"
                 "\n"
                 "Alternatively, you could also say\n"
-                "type summary add -f \"${var%V} -> ${*var}\" \"int *\"\n"
+                "type summary add --summary-string \"${var%V} -> ${*var}\" \"int *\"\n"
                 "and replace the above summary string with\n"
-                "type summary add -f \"the answer is ${var.ptr}, and the question is ${var.value}\" JustADemo\n"
+                "type summary add --summary-string \"the answer is ${var.ptr}, and the question is ${var.value}\" JustADemo\n"
                 "to obtain a similar result\n"
                 "\n"
                 "To add a summary valid for both JustADemo and AnotherDemo you can use the scoping operator, as in:\n"
-                "type summary add -f \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes\n"
+                "type summary add --summary-string \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes\n"
                 "\n"
                 "This will be used for both variables of type JustADemo and AnotherDemo. To prevent this, change the -C to read -C no\n"
                 "If you do not want pointers to be shown using that summary, you can use the -p option, as in:\n"
-                "type summary add -f \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes -p\n"
+                "type summary add --summary-string \"${var.ptr}, ${var.value},{${var.byte}}\" JustADemo -C yes -p\n"
                 "A similar option -r exists for references.\n"
                 "\n"
                 "If you simply want a one-line summary of the content of your variable, without typing an explicit string to that effect\n"
@@ -997,7 +997,7 @@
                 "the output being similar to (ptr=0xsomeaddress, value=3.14)\n"
                 "\n"
                 "If you want to display some summary text, but also expand the structure of your object, you can add the -e option, as in:\n"
-                "type summary add -e -f \"*ptr = ${*var.ptr}\" JustADemo\n"
+                "type summary add -e --summary-string \"*ptr = ${*var.ptr}\" JustADemo\n"
                 "Here the value of the int* is displayed, followed by the standard LLDB sequence of children objects, one per line.\n"
                 "to get an output like:\n"
                 "\n"
@@ -1006,9 +1006,6 @@
                 " value = 3.14\n"
                 "}\n"
                 "\n"
-                "A command you may definitely want to try if you're doing C++ debugging is:\n"
-                "type summary add -f \"${var._M_dataplus._M_p}\" std::string\n"
-                "\n"
                 "You can also add Python summaries, in which case you will use lldb public API to gather information from your variables"
                 "and elaborate them to a meaningful summary inside a script written in Python. The variable object will be passed to your"
                 "script as an SBValue object. The following example might help you when starting to use the Python summaries feature:\n"
@@ -1040,7 +1037,7 @@
                                         Error* error)
 {
     lldb::FormatCategorySP category;
-    Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
+    DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
     
     if (type == eRegexSummary)
     {
@@ -1052,7 +1049,7 @@
             return false;
         }
         
-        category->RegexSummary()->Delete(type_name.GetCString());
+        category->RegexSummary()->Delete(type_name);
         category->RegexSummary()->Add(typeRX, entry);
         
         return true;
@@ -1060,12 +1057,12 @@
     else if (type == eNamedSummary)
     {
         // system named summaries do not exist (yet?)
-        Debugger::Formatting::NamedSummaryFormats::Add(type_name,entry);
+        DataVisualization::NamedSummaryFormats::Add(type_name,entry);
         return true;
     }
     else
     {
-        category->Summary()->Add(type_name.GetCString(), entry);
+        category->Summary()->Add(type_name, entry);
         return true;
     }
 }    
@@ -1080,7 +1077,7 @@
     { LLDB_OPT_SET_ALL, false, "skip-references", 'r', no_argument, NULL, 0, eArgTypeNone,         "Don't use this format for references-to-type objects."},
     { LLDB_OPT_SET_ALL, false,  "regex", 'x', no_argument, NULL, 0, eArgTypeNone,    "Type names are actually regular expressions."},
     { LLDB_OPT_SET_1  , true, "inline-children", 'c', no_argument, NULL, 0, eArgTypeNone,    "If true, inline all child values into summary string."},
-    { LLDB_OPT_SET_2  , true, "format-string", 'f', required_argument, NULL, 0, eArgTypeSummaryString,    "Format string used to display text and object contents."},
+    { LLDB_OPT_SET_2  , true, "summary-string", 'f', required_argument, NULL, 0, eArgTypeSummaryString,    "Summary string used to display text and object contents."},
     { LLDB_OPT_SET_3, false, "python-script", 's', required_argument, NULL, 0, eArgTypeName, "Give a one-liner Python script as part of the command."},
     { LLDB_OPT_SET_3, false, "python-function", 'F', required_argument, NULL, 0, eArgTypeName, "Give the name of a Python function to use for this type."},
     { LLDB_OPT_SET_3, false, "input-python", 'P', no_argument, NULL, 0, eArgTypeNone, "Input Python code to use for this type manually."},
@@ -1168,8 +1165,8 @@
                         const char* cate_name,
                         const FormatCategory::SharedPointer& cate)
     {
-        const char* name = (const char*)param;
-        cate->Delete(name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
+        ConstString *name = (ConstString*)param;
+        cate->Delete(*name, FormatCategory::eSummary | FormatCategory::eRegexSummary);
         return true;
     }
 
@@ -1220,16 +1217,16 @@
         
         if (m_options.m_delete_all)
         {
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
             return result.Succeeded();
         }
         
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
         
-        bool delete_category = category->DeleteSummaries(typeCS.GetCString());
-        bool delete_named = Debugger::Formatting::NamedSummaryFormats::Delete(typeCS);
+        bool delete_category = category->DeleteSummaries(typeCS);
+        bool delete_named = DataVisualization::NamedSummaryFormats::Delete(typeCS);
         
         if (delete_category || delete_named)
         {
@@ -1348,7 +1345,7 @@
     {
         
         if (m_options.m_delete_all)
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
         
         else
         {        
@@ -1357,14 +1354,14 @@
             {
                 const char* cat_name = command.GetArgumentAtIndex(0);
                 ConstString cat_nameCS(cat_name);
-                Debugger::Formatting::Categories::Get(cat_nameCS, category);
+                DataVisualization::Categories::Get(cat_nameCS, category);
             }
             else
-                Debugger::Formatting::Categories::Get(ConstString(NULL), category);
+                DataVisualization::Categories::Get(ConstString(NULL), category);
             category->ClearSummaries();
         }
         
-        Debugger::Formatting::NamedSummaryFormats::Clear();
+        DataVisualization::NamedSummaryFormats::Clear();
         
         result.SetStatus(eReturnStatusSuccessFinishResult);
         return result.Succeeded();
@@ -1383,7 +1380,7 @@
 // CommandObjectTypeSummaryList
 //-------------------------------------------------------------------------
 
-bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, const char* type, const StringSummaryFormat::SharedPointer& entry);
+bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const StringSummaryFormat::SharedPointer& entry);
 bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const StringSummaryFormat::SharedPointer& entry);
 
 class CommandObjectTypeSummaryList;
@@ -1502,9 +1499,9 @@
         else
             param = new CommandObjectTypeSummaryList_LoopCallbackParam(this,&result,NULL,cate_regex);
         
-        Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
+        DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
                 
-        if (Debugger::Formatting::NamedSummaryFormats::GetCount() > 0)
+        if (DataVisualization::NamedSummaryFormats::GetCount() > 0)
         {
             result.GetOutputStream().Printf("Named summaries:\n");
             if (argc == 1) {
@@ -1514,7 +1511,7 @@
             }
             else
                 param = new CommandObjectTypeSummaryList_LoopCallbackParam(this,&result);
-            Debugger::Formatting::NamedSummaryFormats::LoopThrough(CommandObjectTypeSummaryList_LoopCallback, param);
+            DataVisualization::NamedSummaryFormats::LoopThrough(CommandObjectTypeSummaryList_LoopCallback, param);
             delete param;
         }
         
@@ -1558,6 +1555,7 @@
         }
         return true;
     }
+
     
     bool
     LoopCallback (const char* type,
@@ -1570,18 +1568,18 @@
         return true;
     }
     
-    friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, const char* type, const SummaryFormat::SharedPointer& entry);
+    friend bool CommandObjectTypeSummaryList_LoopCallback(void* pt2self, ConstString type, const SummaryFormat::SharedPointer& entry);
     friend bool CommandObjectTypeRXSummaryList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SummaryFormat::SharedPointer& entry);
 };
 
 bool
 CommandObjectTypeSummaryList_LoopCallback (
                                           void* pt2self,
-                                          const char* type,
+                                          ConstString type,
                                           const SummaryFormat::SharedPointer& entry)
 {
     CommandObjectTypeSummaryList_LoopCallbackParam* param = (CommandObjectTypeSummaryList_LoopCallbackParam*)pt2self;
-    return param->self->LoopCallback(type, entry, param->regex, param->result);
+    return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
 }
 
 bool
@@ -1653,7 +1651,7 @@
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
-            Debugger::Formatting::Categories::Enable(typeCS);
+            DataVisualization::Categories::Enable(typeCS);
         }
         
         result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1717,7 +1715,7 @@
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
-            if (!Debugger::Formatting::Categories::Delete(typeCS))
+            if (!DataVisualization::Categories::Delete(typeCS))
                 success = false; // keep deleting even if we hit an error
         }
         if (success)
@@ -1787,7 +1785,7 @@
                 result.SetStatus(eReturnStatusFailed);
                 return false;
             }
-            Debugger::Formatting::Categories::Disable(typeCS);
+            DataVisualization::Categories::Disable(typeCS);
         }
 
         result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1876,7 +1874,7 @@
         CommandObjectTypeCategoryList_CallbackParam param(&result,
                                                           regex);
         
-        Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, &param);
+        DataVisualization::Categories::LoopThrough(PerCategoryCallback, &param);
         
         if (regex)
             delete regex;
@@ -1891,7 +1889,7 @@
 // CommandObjectTypeFilterList
 //-------------------------------------------------------------------------
 
-bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
+bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
 bool CommandObjectTypeFilterRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
 
 class CommandObjectTypeFilterList;
@@ -2010,7 +2008,7 @@
         else
             param = new CommandObjectTypeFilterList_LoopCallbackParam(this,&result,NULL,cate_regex);
         
-        Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
+        DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
         
         if (cate_regex)
             delete cate_regex;
@@ -2065,17 +2063,17 @@
         return true;
     }
     
-    friend bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
+    friend bool CommandObjectTypeFilterList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
     friend bool CommandObjectTypeFilterRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
 };
 
 bool
 CommandObjectTypeFilterList_LoopCallback (void* pt2self,
-                                         const char* type,
+                                         ConstString type,
                                          const SyntheticChildren::SharedPointer& entry)
 {
     CommandObjectTypeFilterList_LoopCallbackParam* param = (CommandObjectTypeFilterList_LoopCallbackParam*)pt2self;
-    return param->self->LoopCallback(type, entry, param->regex, param->result);
+    return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
 }
 
 bool
@@ -2099,7 +2097,7 @@
 // CommandObjectTypeSynthList
 //-------------------------------------------------------------------------
 
-bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
+bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
 bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
 
 class CommandObjectTypeSynthList;
@@ -2218,7 +2216,7 @@
         else
             param = new CommandObjectTypeSynthList_LoopCallbackParam(this,&result,NULL,cate_regex);
         
-        Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback,param);
+        DataVisualization::Categories::LoopThrough(PerCategoryCallback,param);
                 
         if (cate_regex)
             delete cate_regex;
@@ -2273,17 +2271,17 @@
         return true;
     }
     
-    friend bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, const char* type, const SyntheticChildren::SharedPointer& entry);
+    friend bool CommandObjectTypeSynthList_LoopCallback(void* pt2self, ConstString type, const SyntheticChildren::SharedPointer& entry);
     friend bool CommandObjectTypeSynthRXList_LoopCallback(void* pt2self, lldb::RegularExpressionSP regex, const SyntheticChildren::SharedPointer& entry);
 };
 
 bool
 CommandObjectTypeSynthList_LoopCallback (void* pt2self,
-                                         const char* type,
+                                         ConstString type,
                                          const SyntheticChildren::SharedPointer& entry)
 {
     CommandObjectTypeSynthList_LoopCallbackParam* param = (CommandObjectTypeSynthList_LoopCallbackParam*)pt2self;
-    return param->self->LoopCallback(type, entry, param->regex, param->result);
+    return param->self->LoopCallback(type.AsCString(), entry, param->regex, param->result);
 }
 
 bool
@@ -2381,8 +2379,8 @@
                         const char* cate_name,
                         const FormatCategory::SharedPointer& cate)
     {
-        const char* name = (const char*)param;
-        return cate->Delete(name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
+        ConstString *name = (ConstString*)param;
+        return cate->Delete(*name, FormatCategory::eFilter | FormatCategory::eRegexFilter);
     }
     
 public:
@@ -2432,16 +2430,16 @@
         
         if (m_options.m_delete_all)
         {
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)&typeCS);
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
             return result.Succeeded();
         }
         
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
         
-        bool delete_category = category->Filter()->Delete(typeCS.GetCString());
-        delete_category = category->RegexFilter()->Delete(typeCS.GetCString()) || delete_category;
+        bool delete_category = category->Filter()->Delete(typeCS);
+        delete_category = category->RegexFilter()->Delete(typeCS) || delete_category;
         
         if (delete_category)
         {
@@ -2544,8 +2542,8 @@
                         const char* cate_name,
                         const FormatCategory::SharedPointer& cate)
     {
-        const char* name = (const char*)param;
-        return cate->Delete(name, FormatCategory::eSynth | FormatCategory::eRegexSynth);
+        ConstString* name = (ConstString*)param;
+        return cate->Delete(*name, FormatCategory::eSynth | FormatCategory::eRegexSynth);
     }
     
 public:
@@ -2595,16 +2593,16 @@
         
         if (m_options.m_delete_all)
         {
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, (void*)typeCS.GetCString());
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, (void*)&typeCS);
             result.SetStatus(eReturnStatusSuccessFinishNoResult);
             return result.Succeeded();
         }
         
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
         
-        bool delete_category = category->Synth()->Delete(typeCS.GetCString());
-        delete_category = category->RegexSynth()->Delete(typeCS.GetCString()) || delete_category;
+        bool delete_category = category->Synth()->Delete(typeCS);
+        delete_category = category->RegexSynth()->Delete(typeCS) || delete_category;
         
         if (delete_category)
         {
@@ -2726,7 +2724,7 @@
     {
         
         if (m_options.m_delete_all)
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
         
         else
         {        
@@ -2735,10 +2733,10 @@
             {
                 const char* cat_name = command.GetArgumentAtIndex(0);
                 ConstString cat_nameCS(cat_name);
-                Debugger::Formatting::Categories::Get(cat_nameCS, category);
+                DataVisualization::Categories::Get(cat_nameCS, category);
             }
             else
-                Debugger::Formatting::Categories::Get(ConstString(NULL), category);
+                DataVisualization::Categories::Get(ConstString(NULL), category);
             category->Filter()->Clear();
             category->RegexFilter()->Clear();
         }
@@ -2853,7 +2851,7 @@
     {
         
         if (m_options.m_delete_all)
-            Debugger::Formatting::Categories::LoopThrough(PerCategoryCallback, NULL);
+            DataVisualization::Categories::LoopThrough(PerCategoryCallback, NULL);
         
         else
         {        
@@ -2862,10 +2860,10 @@
             {
                 const char* cat_name = command.GetArgumentAtIndex(0);
                 ConstString cat_nameCS(cat_name);
-                Debugger::Formatting::Categories::Get(cat_nameCS, category);
+                DataVisualization::Categories::Get(cat_nameCS, category);
             }
             else
-                Debugger::Formatting::Categories::Get(ConstString(NULL), category);
+                DataVisualization::Categories::Get(ConstString(NULL), category);
             category->Synth()->Clear();
             category->RegexSynth()->Clear();
         }
@@ -3016,7 +3014,7 @@
         
         
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(options->m_category.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(options->m_category.c_str()), category);
         
         Error error;
         
@@ -3133,7 +3131,7 @@
     // now I have a valid provider, let's add it to every type
     
     lldb::FormatCategorySP category;
-    Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
+    DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
     
     Error error;
     
@@ -3191,7 +3189,7 @@
          Error* error)
 {
     lldb::FormatCategorySP category;
-    Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
+    DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
     
     if (category->AnyMatches(type_name,
                              FormatCategory::eFilter | FormatCategory::eRegexFilter,
@@ -3212,14 +3210,14 @@
             return false;
         }
         
-        category->RegexSynth()->Delete(type_name.GetCString());
+        category->RegexSynth()->Delete(type_name);
         category->RegexSynth()->Add(typeRX, entry);
         
         return true;
     }
     else
     {
-        category->Synth()->Add(type_name.GetCString(), entry);
+        category->Synth()->Add(type_name, entry);
         return true;
     }
 }
@@ -3368,7 +3366,7 @@
               Error* error)
     {
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(category_name.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(category_name.c_str()), category);
         
         if (category->AnyMatches(type_name,
                                  FormatCategory::eSynth | FormatCategory::eRegexSynth,
@@ -3389,14 +3387,14 @@
                 return false;
             }
             
-            category->RegexFilter()->Delete(type_name.GetCString());
+            category->RegexFilter()->Delete(type_name);
             category->RegexFilter()->Add(typeRX, entry);
             
             return true;
         }
         else
         {
-            category->Filter()->Add(type_name.GetCString(), entry);
+            category->Filter()->Add(type_name, entry);
             return true;
         }
     }
@@ -3464,7 +3462,7 @@
         // now I have a valid provider, let's add it to every type
         
         lldb::FormatCategorySP category;
-        Debugger::Formatting::Categories::Get(ConstString(m_options.m_category.c_str()), category);
+        DataVisualization::Categories::Get(ConstString(m_options.m_category.c_str()), category);
         
         Error error;
         

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Aug 17 17:13:59 2011
@@ -82,7 +82,6 @@
     if (g_shared_debugger_refcount == 0)
     {
         lldb_private::Initialize();
-        Debugger::FormatManagerInitialize();
     }
     g_shared_debugger_refcount++;
 
@@ -96,7 +95,6 @@
         g_shared_debugger_refcount--;
         if (g_shared_debugger_refcount == 0)
         {
-            Debugger::FormatManagerTerminate();
             lldb_private::WillTerminate();
             lldb_private::Terminate();
 
@@ -829,7 +827,7 @@
 
 
 static ValueObjectSP
-ExpandExpressionPath(ValueObject* vobj,
+ExpandExpressionPath(ValueObject* valobj,
                      StackFrame* frame,
                      bool* do_deref_pointer,
                      const char* var_name_begin,
@@ -846,7 +844,7 @@
             log->Printf("been told to deref_pointer by caller");
         sstring.PutChar('*');
     }
-    else if (vobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(vobj->GetParent()->GetClangType()) && !vobj->IsArrayItemForPointer())
+    else if (valobj->IsDereferenceOfParent() && ClangASTContext::IsPointerType(valobj->GetParent()->GetClangType()) && !valobj->IsArrayItemForPointer())
     {
         if (log)
             log->Printf("decided to deref_pointer myself");
@@ -854,7 +852,7 @@
         *do_deref_pointer = true;
     }
 
-    vobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
+    valobj->GetExpressionPath(sstring, true, ValueObject::eHonorPointers);
     if (log)
         log->Printf("expression path to expand in phase 0: %s",sstring.GetData());
     sstring.PutRawBytes(var_name_begin+3, var_name_final-var_name_begin-3);
@@ -870,7 +868,7 @@
 }
 
 static ValueObjectSP
-ExpandIndexedExpression(ValueObject* vobj,
+ExpandIndexedExpression(ValueObject* valobj,
                         uint32_t index,
                         StackFrame* frame,
                         bool deref_pointer)
@@ -886,7 +884,7 @@
     ValueObject::ExpressionPathEndResultType final_value_type;
     ValueObject::ExpressionPathScanEndReason reason_to_stop;
     ValueObject::ExpressionPathAftermath what_next = (deref_pointer ? ValueObject::eDereference : ValueObject::eNothing);
-    ValueObjectSP item = vobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
+    ValueObjectSP item = valobj->GetValueForExpressionPath (ptr_deref_buffer.get(),
                                                           &first_unparsed,
                                                           &reason_to_stop,
                                                           &final_value_type,
@@ -918,19 +916,19 @@
     const Address *addr,
     Stream &s,
     const char **end,
-    ValueObject* vobj
+    ValueObject* valobj
 )
 {
-    ValueObject* realvobj = NULL; // makes it super-easy to parse pointers
+    ValueObject* realvalobj = NULL; // makes it super-easy to parse pointers
     bool success = true;
     const char *p;
     LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
     for (p = format; *p != '\0'; ++p)
     {
-        if (realvobj)
+        if (realvalobj)
         {
-            vobj = realvobj;
-            realvobj = NULL;
+            valobj = realvalobj;
+            realvalobj = NULL;
         }
         size_t non_special_chars = ::strcspn (p, "${}\\");
         if (non_special_chars > 0)
@@ -959,7 +957,7 @@
 
             ++p;  // Skip the '{'
             
-            if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, vobj))
+            if (FormatPrompt (p, sc, exe_ctx, addr, sub_strm, &p, valobj))
             {
                 // The stream had all it needed
                 s.Write(sub_strm.GetData(), sub_strm.GetSize());
@@ -1011,7 +1009,7 @@
                         case 'v':
                         case 's':
                             {
-                                if (!vobj)
+                                if (!valobj)
                                     break;
                                 
                                 if (log)
@@ -1029,7 +1027,7 @@
                                 
                                 if (*var_name_begin == 's')
                                 {
-                                    vobj = vobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
+                                    valobj = valobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
                                     var_name_begin++;
                                 }
                                 
@@ -1058,18 +1056,18 @@
                                 bool is_array_range = false;
                                 const char* first_unparsed;
 
-                                if (!vobj) break;
-                                // simplest case ${var}, just print vobj's value
+                                if (!valobj) break;
+                                // simplest case ${var}, just print valobj's value
                                 if (::strncmp (var_name_begin, "var}", strlen("var}")) == 0)
                                 {
-                                    target = vobj;
+                                    target = valobj;
                                     val_obj_display = ValueObject::eDisplayValue;
                                 }
                                 else if (::strncmp(var_name_begin,"var%",strlen("var%")) == 0)
                                 {
                                     // this is a variable with some custom format applied to it
                                     const char* percent_position;
-                                    target = vobj;
+                                    target = valobj;
                                     val_obj_display = ValueObject::eDisplayValue;
                                     ScanFormatDescriptor (var_name_begin,
                                                           var_name_end,
@@ -1111,7 +1109,7 @@
                                     if (log)
                                         log->Printf("symbol to expand: %s",expr_path.get());
                                     
-                                    target = vobj->GetValueForExpressionPath(expr_path.get(),
+                                    target = valobj->GetValueForExpressionPath(expr_path.get(),
                                                                              &first_unparsed,
                                                                              &reason_to_stop,
                                                                              &final_value_type,
@@ -1200,7 +1198,7 @@
                                     var_success = true;
 
                                     if (index_higher < 0)
-                                        index_higher = vobj->GetNumChildren() - 1;
+                                        index_higher = valobj->GetNumChildren() - 1;
                                     
                                     uint32_t max_num_children = target->GetUpdatePoint().GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
                                     
@@ -1776,267 +1774,6 @@
     return success;
 }
 
-
-static FormatManager&
-GetFormatManager() {
-    static FormatManager g_format_manager;
-    return g_format_manager;
-}
-
-// The platform should be responsible for initializing its own formatters
-// (e.g. to handle versioning, different runtime libraries, ...)
-// Currently, basic formatters for std:: objects as implemented by
-// the GNU libstdc++ are defined regardless, and enabled by default
-// This is going to be moved to some platform-dependent location
-// (in the meanwhile, these formatters should work for Mac OS X & Linux)
-void
-Debugger::FormatManagerInitialize()
-{
-    static bool g_initialized = false;
-    
-    if (!g_initialized)
-    {
-        g_initialized = true;
-        ConstString gnulib("gnu-libstdc++");
-        FormatManager& format_mgr = GetFormatManager();
-        lldb::FormatCategorySP osxcpp = format_mgr.Category(gnulib.AsCString());
-        osxcpp->Summary()->Add(ConstString("std::string").AsCString(),
-                               SummaryFormatSP(new StringSummaryFormat(true,
-                                                                       false,
-                                                                       false,
-                                                                       true,
-                                                                       true,
-                                                                       false,
-                                                                       "${var._M_dataplus._M_p}")));
-        osxcpp->Summary()->Add(ConstString("std::basic_string<char>").AsCString(),
-                               SummaryFormatSP(new StringSummaryFormat(true,
-                                                                       false,
-                                                                       false,
-                                                                       true,
-                                                                       true,
-                                                                       false,
-                                                                       "${var._M_dataplus._M_p}")));
-        osxcpp->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >").AsCString(),
-                               SummaryFormatSP(new StringSummaryFormat(true,
-                                                                       false,
-                                                                       false,
-                                                                       true,
-                                                                       true,
-                                                                       false,
-                                                                       "${var._M_dataplus._M_p}")));
-        osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
-                                    SyntheticChildrenSP(new SyntheticScriptProvider(true,
-                                                                                    false,
-                                                                                    false,
-                                                                                    "StdVectorSynthProvider")));
-        osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
-                                    SyntheticChildrenSP(new SyntheticScriptProvider(true,
-                                                                                    false,
-                                                                                    false,
-                                                                                    "StdMapSynthProvider")));
-        osxcpp->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
-                                    SyntheticChildrenSP(new SyntheticScriptProvider(true,
-                                                                                    false,
-                                                                                    false,
-                                                                                    "StdListSynthProvider")));
-        
-        format_mgr.EnableCategory(gnulib.AsCString());
-        
-    }
-}
-
-void
-Debugger::FormatManagerTerminate()
-{}
-
-void
-Debugger::Formatting::ForceUpdate()
-{
-    GetFormatManager().Changed();
-}
-
-bool
-Debugger::Formatting::ValueFormats::Get(ValueObject& vobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
-{
-    return GetFormatManager().Value().Get(vobj,entry, use_dynamic);
-}
-
-void
-Debugger::Formatting::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
-{
-    GetFormatManager().Value().Add(type.AsCString(),entry);
-}
-
-bool
-Debugger::Formatting::ValueFormats::Delete(const ConstString &type)
-{
-    return GetFormatManager().Value().Delete(type.AsCString());
-}
-
-void
-Debugger::Formatting::ValueFormats::Clear()
-{
-    GetFormatManager().Value().Clear();
-}
-
-void
-Debugger::Formatting::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
-{
-    GetFormatManager().Value().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::ValueFormats::GetCurrentRevision()
-{
-    return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::ValueFormats::GetCount()
-{
-    return GetFormatManager().Value().GetCount();
-}
-
-bool
-Debugger::Formatting::GetSummaryFormat(ValueObject& vobj,
-                                       lldb::DynamicValueType use_dynamic,
-                                       lldb::SummaryFormatSP& entry)
-{
-    return GetFormatManager().Get(vobj, entry, use_dynamic);
-}
-bool
-Debugger::Formatting::GetSyntheticChildren(ValueObject& vobj,
-                                           lldb::DynamicValueType use_dynamic,
-                                           lldb::SyntheticChildrenSP& entry)
-{
-    return GetFormatManager().Get(vobj, entry, use_dynamic);
-}
-
-bool
-Debugger::Formatting::AnyMatches(ConstString type_name,
-                                 FormatCategory::FormatCategoryItems items,
-                                 bool only_enabled,
-                                 const char** matching_category,
-                                 FormatCategory::FormatCategoryItems* matching_type)
-{
-    return GetFormatManager().AnyMatches(type_name,
-                                         items,
-                                         only_enabled,
-                                         matching_category,
-                                         matching_type);
-}
-
-bool
-Debugger::Formatting::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
-{
-    entry = GetFormatManager().Category(category.GetCString());
-    return true;
-}
-
-void
-Debugger::Formatting::Categories::Add(const ConstString &category)
-{
-    GetFormatManager().Category(category.GetCString());
-}
-
-bool
-Debugger::Formatting::Categories::Delete(const ConstString &category)
-{
-    GetFormatManager().DisableCategory(category.GetCString());
-    return GetFormatManager().Categories().Delete(category.GetCString());
-}
-
-void
-Debugger::Formatting::Categories::Clear()
-{
-    GetFormatManager().Categories().Clear();
-}
-
-void
-Debugger::Formatting::Categories::Clear(ConstString &category)
-{
-    GetFormatManager().Category(category.GetCString())->ClearSummaries();
-}
-
-void
-Debugger::Formatting::Categories::Enable(ConstString& category)
-{
-    if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
-        GetFormatManager().EnableCategory(category.GetCString());
-    else
-    {
-        GetFormatManager().DisableCategory(category.GetCString());
-        GetFormatManager().EnableCategory(category.GetCString());
-    }
-}
-
-void
-Debugger::Formatting::Categories::Disable(ConstString& category)
-{
-    if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
-        GetFormatManager().DisableCategory(category.GetCString());
-}
-
-void
-Debugger::Formatting::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
-{
-    GetFormatManager().LoopThroughCategories(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::Categories::GetCurrentRevision()
-{
-    return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::Categories::GetCount()
-{
-    return GetFormatManager().Categories().GetCount();
-}
-
-bool
-Debugger::Formatting::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
-{
-    return GetFormatManager().NamedSummary().Get(type.AsCString(),entry);
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
-{
-    GetFormatManager().NamedSummary().Add(type.AsCString(),entry);
-}
-
-bool
-Debugger::Formatting::NamedSummaryFormats::Delete(const ConstString &type)
-{
-    return GetFormatManager().NamedSummary().Delete(type.AsCString());
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::Clear()
-{
-    GetFormatManager().NamedSummary().Clear();
-}
-
-void
-Debugger::Formatting::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
-{
-    GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
-}
-
-uint32_t
-Debugger::Formatting::NamedSummaryFormats::GetCurrentRevision()
-{
-    return GetFormatManager().GetCurrentRevision();
-}
-
-uint32_t
-Debugger::Formatting::NamedSummaryFormats::GetCount()
-{
-    return GetFormatManager().NamedSummary().GetCount();
-}
-
 #pragma mark Debugger::SettingsController
 
 //--------------------------------------------------

Modified: lldb/trunk/source/Core/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatClasses.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatClasses.cpp (original)
+++ lldb/trunk/source/Core/FormatClasses.cpp Wed Aug 17 17:13:59 2011
@@ -69,15 +69,15 @@
     
     if (m_show_members_oneliner)
     {
-        ValueObjectSP synth_vobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
-        const uint32_t num_children = synth_vobj->GetNumChildren();
+        ValueObjectSP synth_valobj = object->GetSyntheticValue(lldb::eUseSyntheticFilter);
+        const uint32_t num_children = synth_valobj->GetNumChildren();
         if (num_children)
         {
             s.PutChar('(');
             
             for (uint32_t idx=0; idx<num_children; ++idx)
             {
-                lldb::ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
+                lldb::ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
                 if (child_sp.get())
                 {
                     if (idx)

Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Wed Aug 17 17:13:59 2011
@@ -156,14 +156,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(const char* key, SummaryFormat::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Get(ConstString key, SummaryFormat::SharedPointer& value)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if (regex->Execute(key))
+        if (regex->Execute(key.AsCString()))
         {
             value = pos->second;
             return true;
@@ -174,14 +174,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SummaryFormat>::Delete(ConstString type)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if ( ::strcmp(type,regex->GetText()) == 0)
+        if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
         {
             m_format_map.map().erase(pos);
             if (m_format_map.listener)
@@ -194,14 +194,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(const char* key, SyntheticFilter::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if (regex->Execute(key))
+        if (regex->Execute(key.AsCString()))
         {
             value = pos->second;
             return true;
@@ -212,14 +212,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticFilter>::Delete(ConstString type)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if ( ::strcmp(type,regex->GetText()) == 0)
+        if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
         {
             m_format_map.map().erase(pos);
             if (m_format_map.listener)
@@ -232,14 +232,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(const char* key, SyntheticFilter::SharedPointer& value)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Get(ConstString key, SyntheticFilter::SharedPointer& value)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if (regex->Execute(key))
+        if (regex->Execute(key.AsCString()))
         {
             value = pos->second;
             return true;
@@ -250,14 +250,14 @@
 
 template<>
 bool
-FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(const char* type)
+FormatNavigator<lldb::RegularExpressionSP, SyntheticScriptProvider>::Delete(ConstString type)
 {
     Mutex::Locker(m_format_map.mutex());
     MapIterator pos, end = m_format_map.map().end();
     for (pos = m_format_map.map().begin(); pos != end; pos++)
     {
         lldb::RegularExpressionSP regex = pos->first;
-        if ( ::strcmp(type,regex->GetText()) == 0)
+        if ( ::strcmp(type.AsCString(),regex->GetText()) == 0)
         {
             m_format_map.map().erase(pos);
             if (m_format_map.listener)
@@ -297,3 +297,286 @@
             return lldb::eFormatInvalid;
     }
 }
+
+FormatManager::FormatManager() : 
+    m_value_nav("format",this),
+    m_named_summaries_map(this),
+    m_last_revision(0),
+    m_categories_map(this),
+    m_default_cs(ConstString("default")),
+    m_system_cs(ConstString("system")), 
+    m_gnu_stdcpp_cs(ConstString("gnu-libstdc++"))
+{
+    
+    // build default categories
+    
+    m_default_category_name = m_default_cs.GetCString();
+    m_system_category_name = m_system_cs.GetCString();
+    m_gnu_cpp_category_name = m_gnu_stdcpp_cs.AsCString();
+    
+    // add some default stuff
+    // most formats, summaries, ... actually belong to the users' lldbinit file rather than here
+    SummaryFormat::SharedPointer string_format(new StringSummaryFormat(false,
+                                                                       true,
+                                                                       false,
+                                                                       true,
+                                                                       false,
+                                                                       false,
+                                                                       "${var%s}"));
+    
+    
+    SummaryFormat::SharedPointer string_array_format(new StringSummaryFormat(false,
+                                                                             true,
+                                                                             false,
+                                                                             false,
+                                                                             false,
+                                                                             false,
+                                                                             "${var%s}"));
+    
+    lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
+    
+    
+    Category(m_system_category_name)->Summary()->Add(ConstString("char *"), string_format);
+    Category(m_system_category_name)->Summary()->Add(ConstString("const char *"), string_format);
+    Category(m_system_category_name)->RegexSummary()->Add(any_size_char_arr, string_array_format);
+    
+    Category(m_default_category_name); // this call is there to force LLDB into creating an empty "default" category
+    
+    // WARNING: temporary code!!
+    // The platform should be responsible for initializing its own formatters
+    // (e.g. to handle versioning, different runtime libraries, ...)
+    // Currently, basic formatters for std:: objects as implemented by
+    // the GNU libstdc++ are defined regardless, and enabled by default
+    // This is going to be moved to some platform-dependent location
+    // (in the meanwhile, these formatters should work for Mac OS X & Linux)
+    lldb::SummaryFormatSP std_string_summary_sp(new StringSummaryFormat(true,
+                                                                        false,
+                                                                        false,
+                                                                        true,
+                                                                        true,
+                                                                        false,
+                                                                        "${var._M_dataplus._M_p}"));
+    Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::string"),
+                                                      std_string_summary_sp);
+    Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char>"),
+                                                      std_string_summary_sp);
+    Category(m_gnu_cpp_category_name)->Summary()->Add(ConstString("std::basic_string<char,std::char_traits<char>,std::allocator<char> >"),
+                                                      std_string_summary_sp);
+    
+    Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::vector<")),
+                                     SyntheticChildrenSP(new SyntheticScriptProvider(true,
+                                                                                     false,
+                                                                                     false,
+                                                                                     "StdVectorSynthProvider")));
+    Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::map<")),
+                                     SyntheticChildrenSP(new SyntheticScriptProvider(true,
+                                                                                     false,
+                                                                                     false,
+                                                                                     "StdMapSynthProvider")));
+    Category(m_gnu_cpp_category_name)->RegexSynth()->Add(RegularExpressionSP(new RegularExpression("std::list<")),
+                                     SyntheticChildrenSP(new SyntheticScriptProvider(true,
+                                                                                     false,
+                                                                                     false,
+                                                                                     "StdListSynthProvider")));
+    
+    // DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
+    EnableCategory(m_system_category_name);
+    EnableCategory(m_gnu_cpp_category_name);
+    EnableCategory(m_default_category_name);
+    
+}
+
+
+static FormatManager&
+GetFormatManager() {
+    static FormatManager g_format_manager;
+    return g_format_manager;
+}
+
+void
+DataVisualization::ForceUpdate()
+{
+    GetFormatManager().Changed();
+}
+
+bool
+DataVisualization::ValueFormats::Get(ValueObject& valobj, lldb::DynamicValueType use_dynamic, ValueFormat::SharedPointer &entry)
+{
+    return GetFormatManager().Value().Get(valobj,entry, use_dynamic);
+}
+
+void
+DataVisualization::ValueFormats::Add(const ConstString &type, const ValueFormat::SharedPointer &entry)
+{
+    GetFormatManager().Value().Add(type,entry);
+}
+
+bool
+DataVisualization::ValueFormats::Delete(const ConstString &type)
+{
+    return GetFormatManager().Value().Delete(type);
+}
+
+void
+DataVisualization::ValueFormats::Clear()
+{
+    GetFormatManager().Value().Clear();
+}
+
+void
+DataVisualization::ValueFormats::LoopThrough(ValueFormat::ValueCallback callback, void* callback_baton)
+{
+    GetFormatManager().Value().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::ValueFormats::GetCurrentRevision()
+{
+    return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::ValueFormats::GetCount()
+{
+    return GetFormatManager().Value().GetCount();
+}
+
+bool
+DataVisualization::GetSummaryFormat(ValueObject& valobj,
+                                       lldb::DynamicValueType use_dynamic,
+                                       lldb::SummaryFormatSP& entry)
+{
+    return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+bool
+DataVisualization::GetSyntheticChildren(ValueObject& valobj,
+                                           lldb::DynamicValueType use_dynamic,
+                                           lldb::SyntheticChildrenSP& entry)
+{
+    return GetFormatManager().Get(valobj, entry, use_dynamic);
+}
+
+bool
+DataVisualization::AnyMatches(ConstString type_name,
+                                 FormatCategory::FormatCategoryItems items,
+                                 bool only_enabled,
+                                 const char** matching_category,
+                                 FormatCategory::FormatCategoryItems* matching_type)
+{
+    return GetFormatManager().AnyMatches(type_name,
+                                         items,
+                                         only_enabled,
+                                         matching_category,
+                                         matching_type);
+}
+
+bool
+DataVisualization::Categories::Get(const ConstString &category, lldb::FormatCategorySP &entry)
+{
+    entry = GetFormatManager().Category(category.GetCString());
+    return true;
+}
+
+void
+DataVisualization::Categories::Add(const ConstString &category)
+{
+    GetFormatManager().Category(category.GetCString());
+}
+
+bool
+DataVisualization::Categories::Delete(const ConstString &category)
+{
+    GetFormatManager().DisableCategory(category.GetCString());
+    return GetFormatManager().Categories().Delete(category.GetCString());
+}
+
+void
+DataVisualization::Categories::Clear()
+{
+    GetFormatManager().Categories().Clear();
+}
+
+void
+DataVisualization::Categories::Clear(ConstString &category)
+{
+    GetFormatManager().Category(category.GetCString())->ClearSummaries();
+}
+
+void
+DataVisualization::Categories::Enable(ConstString& category)
+{
+    if (GetFormatManager().Category(category.GetCString())->IsEnabled() == false)
+        GetFormatManager().EnableCategory(category.GetCString());
+    else
+    {
+        GetFormatManager().DisableCategory(category.GetCString());
+        GetFormatManager().EnableCategory(category.GetCString());
+    }
+}
+
+void
+DataVisualization::Categories::Disable(ConstString& category)
+{
+    if (GetFormatManager().Category(category.GetCString())->IsEnabled() == true)
+        GetFormatManager().DisableCategory(category.GetCString());
+}
+
+void
+DataVisualization::Categories::LoopThrough(FormatManager::CategoryCallback callback, void* callback_baton)
+{
+    GetFormatManager().LoopThroughCategories(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::Categories::GetCurrentRevision()
+{
+    return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::Categories::GetCount()
+{
+    return GetFormatManager().Categories().GetCount();
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Get(const ConstString &type, SummaryFormat::SharedPointer &entry)
+{
+    return GetFormatManager().NamedSummary().Get(type,entry);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Add(const ConstString &type, const SummaryFormat::SharedPointer &entry)
+{
+    GetFormatManager().NamedSummary().Add(type,entry);
+}
+
+bool
+DataVisualization::NamedSummaryFormats::Delete(const ConstString &type)
+{
+    return GetFormatManager().NamedSummary().Delete(type);
+}
+
+void
+DataVisualization::NamedSummaryFormats::Clear()
+{
+    GetFormatManager().NamedSummary().Clear();
+}
+
+void
+DataVisualization::NamedSummaryFormats::LoopThrough(SummaryFormat::SummaryCallback callback, void* callback_baton)
+{
+    GetFormatManager().NamedSummary().LoopThrough(callback, callback_baton);
+}
+
+uint32_t
+DataVisualization::NamedSummaryFormats::GetCurrentRevision()
+{
+    return GetFormatManager().GetCurrentRevision();
+}
+
+uint32_t
+DataVisualization::NamedSummaryFormats::GetCount()
+{
+    return GetFormatManager().NamedSummary().GetCount();
+}
\ No newline at end of file

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Aug 17 17:13:59 2011
@@ -20,6 +20,7 @@
 // Project includes
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/FormatManager.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Core/ValueObjectChild.h"
@@ -223,13 +224,13 @@
         log->Printf("checking for FormatManager revisions. VO named %s is at revision %d, while the format manager is at revision %d",
            GetName().GetCString(),
            m_last_format_mgr_revision,
-           Debugger::Formatting::ValueFormats::GetCurrentRevision());
+           DataVisualization::ValueFormats::GetCurrentRevision());
     if (HasCustomSummaryFormat() && m_update_point.GetModID() != m_user_id_of_forced_summary)
     {
         ClearCustomSummaryFormat();
         m_summary_str.clear();
     }
-    if ( (m_last_format_mgr_revision != Debugger::Formatting::ValueFormats::GetCurrentRevision()) ||
+    if ( (m_last_format_mgr_revision != DataVisualization::ValueFormats::GetCurrentRevision()) ||
           m_last_format_mgr_dynamic != use_dynamic)
     {
         if (m_last_summary_format.get())
@@ -241,11 +242,11 @@
 
         m_synthetic_value = NULL;
         
-        Debugger::Formatting::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
-        Debugger::Formatting::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
-        Debugger::Formatting::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
+        DataVisualization::ValueFormats::Get(*this, lldb::eNoDynamicValues, m_last_value_format);
+        DataVisualization::GetSummaryFormat(*this, use_dynamic, m_last_summary_format);
+        DataVisualization::GetSyntheticChildren(*this, use_dynamic, m_last_synthetic_filter);
 
-        m_last_format_mgr_revision = Debugger::Formatting::ValueFormats::GetCurrentRevision();
+        m_last_format_mgr_revision = DataVisualization::ValueFormats::GetCurrentRevision();
         m_last_format_mgr_dynamic = use_dynamic;
 
         ClearUserVisibleData();
@@ -2852,10 +2853,10 @@
                 
                 if (print_children && (!entry || entry->DoesPrintChildren() || !sum_cstr))
                 {
-                    ValueObjectSP synth_vobj = valobj->GetSyntheticValue(use_synth ?
+                    ValueObjectSP synth_valobj = valobj->GetSyntheticValue(use_synth ?
                                                                          lldb::eUseSyntheticFilter : 
                                                                          lldb::eNoSyntheticFilter);
-                    uint32_t num_children = synth_vobj->GetNumChildren();
+                    uint32_t num_children = synth_valobj->GetNumChildren();
                     bool print_dotdotdot = false;
                     if (num_children)
                     {
@@ -2881,7 +2882,7 @@
 
                         for (uint32_t idx=0; idx<num_children; ++idx)
                         {
-                            ValueObjectSP child_sp(synth_vobj->GetChildAtIndex(idx, true));
+                            ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true));
                             if (child_sp.get())
                             {
                                 DumpValueObject (s,

Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Wed Aug 17 17:13:59 2011
@@ -15,7 +15,7 @@
 // Project includes
 
 #include "lldb/Core/Debugger.h"
-
+#include "lldb/Core/FormatManager.h"
 #include "lldb/Interpreter/Args.h"
 
 #include "lldb/Interpreter/CommandReturnObject.h"
@@ -57,7 +57,7 @@
         result.SetStatus (eReturnStatusFailed);
     }
 
-    Debugger::Formatting::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
+    DataVisualization::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
     
     if (command == NULL || command[0] == '\0') {
         script_interpreter->ExecuteInterpreterLoop ();

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Wed Aug 17 17:13:59 2011
@@ -174,7 +174,7 @@
     PyRun_SimpleString (run_string.GetData());
     
     run_string.Clear();
-    run_string.Printf ("run_one_line (%s, 'from osxcpp import *')", m_dictionary_name.c_str(),
+    run_string.Printf ("run_one_line (%s, 'from gnu_libstdcpp import *')", m_dictionary_name.c_str(),
                        interpreter.GetDebugger().GetID());
     PyRun_SimpleString (run_string.GetData());
     

Removed: lldb/trunk/source/osxcpp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/osxcpp.py?rev=137885&view=auto
==============================================================================
--- lldb/trunk/source/osxcpp.py (original)
+++ lldb/trunk/source/osxcpp.py (removed)
@@ -1,231 +0,0 @@
-import re
-
-# C++ STL formatters for LLDB
-# These formatters are based upon the version of the STL that ships
-# with Mac OS X Snow Leopard 10.6.8 and OS X Lion 10.7.0
-# The STL implementation *might* change on other releases of Apple's
-# operating system and library infrastructure, and might be different on
-# other operating systems
-
-class StdListSynthProvider:
-
-	def __init__(self, valobj, dict):
-		self.valobj = valobj
-		self.update()
-
-	def num_children(self):
-		next_val = self.next.GetValueAsUnsigned(0)
-		prev_val = self.prev.GetValueAsUnsigned(0)
-		# After a std::list has been initialized, both next and prev will be non-NULL
-		if next_val == 0 or prev_val == 0:
-			return 0
-		if next_val == self.node_address:
-			return 0
-		if next_val == prev_val:
-			return 1
-		size = 2
-		current = self.next
-		while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
-			size = size + 1
-			current = current.GetChildMemberWithName('_M_next')
-		return (size - 1)
-
-	def get_child_index(self,name):
-		return int(name.lstrip('[').rstrip(']'))
-
-	def get_child_at_index(self,index):
-		if index >= self.num_children():
-			return None;
-		offset = index
-		current = self.next
-		while offset > 0:
-			current = current.GetChildMemberWithName('_M_next')
-			offset = offset - 1
-		return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
-
-	def extract_type_name(self,name):
-		self.type_name = name[16:]
-		index = 2
-		count_of_template = 1
-		while index < len(self.type_name):
-			if self.type_name[index] == '<':
-				count_of_template = count_of_template + 1
-			elif self.type_name[index] == '>':
-				count_of_template = count_of_template - 1
-			elif self.type_name[index] == ',' and count_of_template == 1:
-				self.type_name = self.type_name[:index]
-				break
-			index = index + 1
-		self.type_name_nospaces = self.type_name.replace(", ", ",")
-
-	def update(self):
-		impl = self.valobj.GetChildMemberWithName('_M_impl')
-		node = impl.GetChildMemberWithName('_M_node')
-		self.extract_type_name(impl.GetType().GetName())
-		self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
-		self.next = node.GetChildMemberWithName('_M_next')
-		self.prev = node.GetChildMemberWithName('_M_prev')
-		self.data_type = node.GetTarget().FindFirstType(self.type_name)
-		# tries to fight against a difference in formatting type names between gcc and clang
-		if self.data_type.IsValid() == False:
-			self.data_type = node.GetTarget().FindFirstType(self.type_name_nospaces)
-		self.data_size = self.data_type.GetByteSize()
-
-class StdVectorSynthProvider:
-
-	def __init__(self, valobj, dict):
-		self.valobj = valobj;
-		self.update()
-
-	def num_children(self):
-		start_val = self.start.GetValueAsUnsigned(0)
-		finish_val = self.finish.GetValueAsUnsigned(0)
-		end_val  = self.end.GetValueAsUnsigned(0)
-		# Before a vector has been constructed, it will contain bad values
-		# so we really need to be careful about the length we return since
-		# unitialized data can cause us to return a huge number. We need
-		# to also check for any of the start, finish or end of storage values
-		# being zero (NULL). If any are, then this vector has not been 
-		# initialized yet and we should return zero
-
-		# Make sure nothing is NULL
-		if start_val == 0 or finish_val == 0 or end_val == 0:
-			return 0
-		# Make sure start is less than finish
-		if start_val >= finish_val:
-			return 0
-		# Make sure finish is less than or equal to end of storage
-		if finish_val > end_val:
-			return 0
-
-		num_children = (finish_val-start_val)/self.data_size
-		return num_children
-
-	def get_child_index(self,name):
-		return int(name.lstrip('[').rstrip(']'))
-
-	def get_child_at_index(self,index):
-		if index >= self.num_children():
-			return None;
-		offset = index * self.data_size
-		return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
-
-	def update(self):
-		impl = self.valobj.GetChildMemberWithName('_M_impl')
-		self.start = impl.GetChildMemberWithName('_M_start')
-		self.finish = impl.GetChildMemberWithName('_M_finish')
-		self.end = impl.GetChildMemberWithName('_M_end_of_storage')
-		self.data_type = self.start.GetType().GetPointeeType()
-		self.data_size = self.data_type.GetByteSize()
-
-
-class StdMapSynthProvider:
-
-	def __init__(self, valobj, dict):
-		self.valobj = valobj;
-		self.update()
-
-	def update(self):
-		self.Mt = self.valobj.GetChildMemberWithName('_M_t')
-		self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
-		self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header')
-		# from libstdc++ implementation of _M_root for rbtree
-		self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
-		# the stuff into the tree is actually a std::pair<const key, value>
-		# life would be much easier if gcc had a coherent way to print out
-		# template names in debug info
-		self.expand_clang_type_name()
-		self.expand_gcc_type_name()
-		self.data_type = self.Mt.GetTarget().FindFirstType(self.clang_type_name)
-		if self.data_type.IsValid() == False:
-			self.data_type = self.Mt.GetTarget().FindFirstType(self.gcc_type_name)
-		self.data_size = self.data_type.GetByteSize()
-		self.skip_size = self.Mheader.GetType().GetByteSize()
-
-	def expand_clang_type_name(self):
-		type_name = self.Mimpl.GetType().GetName()
-		index = type_name.find("std::pair<")
-		type_name = type_name[index+5:]
-		index = 6
-		template_count = 1
-		while index < len(type_name):
-			if type_name[index] == '<':
-				template_count = template_count + 1
-			elif type_name[index] == '>' and template_count == 1:
-				type_name = type_name[:index+1]
-				break
-			elif type_name[index] == '>':
-				template_count = template_count - 1
-			index = index + 1;
-		self.clang_type_name = type_name
-
-	def expand_gcc_type_name(self):
-		type_name = self.Mt.GetType().GetName()
-		index = type_name.find("std::pair<")
-		type_name = type_name[index+5:]
-		index = 6
-		template_count = 1
-		while index < len(type_name):
-			if type_name[index] == '<':
-				template_count = template_count + 1
-			elif type_name[index] == '>' and template_count == 1:
-				type_name = type_name[:index+1]
-				break
-			elif type_name[index] == '>':
-				template_count = template_count - 1
-			elif type_name[index] == ' ' and template_count == 1 and type_name[index-1] == ',':
-			    type_name = type_name[0:index] + type_name[index+1:]
-			    index = index - 1
-			index = index + 1;
-		self.gcc_type_name = type_name
-
-	def num_children(self):
-		root_ptr_val = self.node_ptr_value(self.Mroot)
-		if root_ptr_val == 0:
-			return 0;
-		return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
-
-	def get_child_index(self,name):
-		return int(name.lstrip('[').rstrip(']'))
-
-	def get_child_at_index(self,index):
-		if index >= self.num_children():
-			return None;
-		offset = index
-		current = self.left(self.Mheader);
-		while offset > 0:
-			current = self.increment_node(current)
-			offset = offset - 1;
-		# skip all the base stuff and get at the data
-		return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
-
-	# utility functions
-	def node_ptr_value(self,node):
-		return node.GetValueAsUnsigned(0)
-
-	def right(self,node):
-		return node.GetChildMemberWithName("_M_right");
-
-	def left(self,node):
-		return node.GetChildMemberWithName("_M_left");
-
-	def parent(self,node):
-		return node.GetChildMemberWithName("_M_parent");
-
-	# from libstdc++ implementation of iterator for rbtree
-	def increment_node(self,node):
-		if self.node_ptr_value(self.right(node)) != 0:
-			x = self.right(node);
-			while self.node_ptr_value(self.left(x)) != 0:
-				x = self.left(x);
-			return x;
-		else:
-			x = node;
-			y = self.parent(x)
-			while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))):
-				x = y;
-				y = self.parent(y);
-			if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y):
-				x = y;
-			return x;
-

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py?rev=137886&r1=137885&r2=137886&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py Wed Aug 17 17:13:59 2011
@@ -54,7 +54,7 @@
         self.addTearDownHook(cleanup)
 
         # Setup the summaries for this scenario
-        self.runCmd("type summary add -f \"${var._M_dataplus._M_p}\" std::string") # This works fine on OSX 10.6.8, if it differs on your implementation, submit a patch to adapt it to your C++ stdlib
+        #self.runCmd("type summary add -f \"${var._M_dataplus._M_p}\" std::string")
         self.runCmd("type summary add -f \"Level 1\" \"DeepData_1\"")
         self.runCmd("type summary add -f \"Level 2\" \"DeepData_2\" -e")
         self.runCmd("type summary add -f \"Level 3\" \"DeepData_3\"")





More information about the lldb-commits mailing list