[Lldb-commits] [lldb] r153541 - in /lldb/trunk: examples/summaries/cocoa/objc_runtime.py scripts/Python/finish-swig-Python-LLDB.sh source/Core/FormatManager.cpp source/Interpreter/ScriptInterpreterPython.cpp test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py test/functionalities/data-formatter/data-formatter-objc/main.m

Enrico Granata egranata at apple.com
Tue Mar 27 14:49:20 PDT 2012


Author: enrico
Date: Tue Mar 27 16:49:20 2012
New Revision: 153541

URL: http://llvm.org/viewvc/llvm-project?rev=153541&view=rev
Log:
adding a summary for Objective-C type 'Class'

Modified:
    lldb/trunk/examples/summaries/cocoa/objc_runtime.py
    lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh
    lldb/trunk/source/Core/FormatManager.cpp
    lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
    lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
    lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m

Modified: lldb/trunk/examples/summaries/cocoa/objc_runtime.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/summaries/cocoa/objc_runtime.py?rev=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/examples/summaries/cocoa/objc_runtime.py (original)
+++ lldb/trunk/examples/summaries/cocoa/objc_runtime.py Tue Mar 27 16:49:20 2012
@@ -593,6 +593,12 @@
 			return 1
 		return 2
 
+	@staticmethod
+	def runtime_from_isa(isa):
+		runtime = ObjCRuntime(isa)
+		runtime.isa = isa
+		return runtime
+
 	def __init__(self,valobj):
 		self.valobj = valobj
 		self.adjust_for_architecture()

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=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original)
+++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Tue Mar 27 16:49:20 2012
@@ -452,6 +452,20 @@
     fi
 fi
 
+if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Class.py" ]
+then
+    if [ $Debug == 1 ]
+    then
+        echo "Copying Class.py to ${framework_python_dir}"
+    fi
+    cp "${SRC_ROOT}/examples/summaries/cocoa/Class.py" "${framework_python_dir}"
+else
+    if [ $Debug == 1 ]
+    then
+        echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Class.py"
+    fi
+fi
+
 if [ -f "${SRC_ROOT}/examples/summaries/cocoa/cache.py" ]
 then
     if [ $Debug == 1 ]

Modified: lldb/trunk/source/Core/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatManager.cpp (original)
+++ lldb/trunk/source/Core/FormatManager.cpp Tue Mar 27 16:49:20 2012
@@ -796,6 +796,7 @@
     AddScriptSummary(objc_category_sp, "Selector.SEL_Summary", ConstString("struct objc_selector"), objc_flags);
     AddScriptSummary(objc_category_sp, "Selector.SEL_Summary", ConstString("objc_selector"), objc_flags);
     AddScriptSummary(objc_category_sp, "Selector.SELPointer_Summary", ConstString("objc_selector *"), objc_flags);
+    AddScriptSummary(objc_category_sp, "Class.Class_Summary", ConstString("Class"), objc_flags);
     objc_flags.SetSkipPointers(false);
 
     TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Tue Mar 27 16:49:20 2012
@@ -303,7 +303,7 @@
     // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set
     // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task
     run_string.Clear();
-    run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, CFBitVector')", m_dictionary_name.c_str());
+    run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, Class, CFBitVector')", m_dictionary_name.c_str());
     PyRun_SimpleString (run_string.GetData());
 
     int new_count = Debugger::TestDebuggerRefCount();

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py?rev=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py Tue Mar 27 16:49:20 2012
@@ -297,6 +297,20 @@
                     '@"Europe/Paris"'])
 
 
+        self.runCmd('type category list')
+        self.runCmd('type summary list')
+        self.expect('frame variable myclass',
+                    substrs = ['(Class) myclass = NSValue'])
+        self.expect('frame variable myclass2',
+                    substrs = ['(Class) myclass2 = __NSCFConstantString'])
+        self.expect('frame variable myclass3',
+                    substrs = ['(Class) myclass3 = Molecule'])
+        self.expect('frame variable myclass4',
+                    substrs = ['(Class) myclass4 = NSMutableArray'])
+        self.expect('frame variable myclass5',
+                    substrs = ['(Class) myclass5 = <error: unknown Class>'])
+
+
     def expr_objc_data_formatter_commands(self):
         """Test common cases of expression parser <--> formatters interaction."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=153541&r1=153540&r2=153541&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-objc/main.m Tue Mar 27 16:49:20 2012
@@ -631,6 +631,12 @@
 
 	Molecule *molecule = [Molecule new];
 
+	Class myclass = NSClassFromString(@"NSValue");
+	Class myclass2 = [str0 class];
+	Class myclass3 = [molecule class];
+	Class myclass4 = NSClassFromString(@"NSMutableArray");
+	Class myclass5 = [nil class];
+
     // Set break point at this line.
 
     [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];





More information about the lldb-commits mailing list