[Lldb-commits] [lldb] r226062 - Reenable the logic to take an integer value and attempt to "po" it as an ObjC object

Enrico Granata egranata at apple.com
Wed Jan 14 15:58:18 PST 2015


Author: enrico
Date: Wed Jan 14 17:58:18 2015
New Revision: 226062

URL: http://llvm.org/viewvc/llvm-project?rev=226062&view=rev
Log:
Reenable the logic to take an integer value and attempt to "po" it as an ObjC object

While there is quite a bit of potential for mishaps due to tagged pointers, and after quite some internal discussion, this seems a saner behavior given how "po" stands for "print OBJECT". The argument being that we should make at least some sensible attempt to print the thing the user passed as-if it was an object

Fixes rdar://19423124


Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=226062&r1=226061&r2=226062&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Wed Jan 14 17:58:18 2015
@@ -42,8 +42,11 @@ using namespace lldb_private;
 bool
 AppleObjCRuntime::GetObjectDescription (Stream &str, ValueObject &valobj)
 {
-    // ObjC objects can only be pointers
-    if (!valobj.IsPointerType())
+    ClangASTType clang_type(valobj.GetClangType());
+    bool is_signed;
+    // ObjC objects can only be pointers (or numbers that actually represents pointers
+    // but haven't been typecast, because reasons..)
+    if (!clang_type.IsIntegerType (is_signed) && !clang_type.IsPointerType ())
         return false;
     
     // Make the argument list: we pass one arg, the address of our pointer, to the print function.





More information about the lldb-commits mailing list