[Lldb-commits] [lldb] r114739 - in /lldb/trunk: source/Symbol/ClangASTType.cpp test/bitfields/TestBitfields.py test/set_values/TestSetValues.py test/unsigned_types/TestUnsignedTypes.py

Johnny Chen johnny.chen at apple.com
Fri Sep 24 10:33:29 PDT 2010


Author: johnny
Date: Fri Sep 24 12:33:29 2010
New Revision: 114739

URL: http://llvm.org/viewvc/llvm-project?rev=114739&view=rev
Log:
Made 'frame variable' printing of unsigned types more readable, like gdb.

Modified:
    lldb/trunk/source/Symbol/ClangASTType.cpp
    lldb/trunk/test/bitfields/TestBitfields.py
    lldb/trunk/test/set_values/TestSetValues.py
    lldb/trunk/test/unsigned_types/TestUnsignedTypes.py

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=114739&r1=114738&r2=114739&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Sep 24 12:33:29 2010
@@ -237,15 +237,15 @@
         case clang::BuiltinType::WChar:         return lldb::eFormatChar;
         case clang::BuiltinType::Char16:        return lldb::eFormatUnicode16;
         case clang::BuiltinType::Char32:        return lldb::eFormatUnicode32;
-        case clang::BuiltinType::UShort:        return lldb::eFormatHex;
+        case clang::BuiltinType::UShort:        return lldb::eFormatUnsigned;
         case clang::BuiltinType::Short:         return lldb::eFormatDecimal;
-        case clang::BuiltinType::UInt:          return lldb::eFormatHex;
+        case clang::BuiltinType::UInt:          return lldb::eFormatUnsigned;
         case clang::BuiltinType::Int:           return lldb::eFormatDecimal;
-        case clang::BuiltinType::ULong:         return lldb::eFormatHex;
+        case clang::BuiltinType::ULong:         return lldb::eFormatUnsigned;
         case clang::BuiltinType::Long:          return lldb::eFormatDecimal;
-        case clang::BuiltinType::ULongLong:     return lldb::eFormatHex;
+        case clang::BuiltinType::ULongLong:     return lldb::eFormatUnsigned;
         case clang::BuiltinType::LongLong:      return lldb::eFormatDecimal;
-        case clang::BuiltinType::UInt128:       return lldb::eFormatHex;
+        case clang::BuiltinType::UInt128:       return lldb::eFormatUnsigned;
         case clang::BuiltinType::Int128:        return lldb::eFormatDecimal;
         case clang::BuiltinType::Float:         return lldb::eFormatFloat;
         case clang::BuiltinType::Double:        return lldb::eFormatFloat;

Modified: lldb/trunk/test/bitfields/TestBitfields.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bitfields/TestBitfields.py?rev=114739&r1=114738&r2=114739&view=diff
==============================================================================
--- lldb/trunk/test/bitfields/TestBitfields.py (original)
+++ lldb/trunk/test/bitfields/TestBitfields.py Fri Sep 24 12:33:29 2010
@@ -53,26 +53,26 @@
 
         # This should display correctly.
         self.expect("frame variable bits", VARIABLES_DISPLAYED_CORRECTLY,
-            substrs = ['(uint32_t:1) b1 = 0x00000001,',
-                       '(uint32_t:2) b2 = 0x00000003,',
-                       '(uint32_t:3) b3 = 0x00000007,',
-                       '(uint32_t:4) b4 = 0x0000000f,',
-                       '(uint32_t:5) b5 = 0x0000001f,',
-                       '(uint32_t:6) b6 = 0x0000003f,',
-                       '(uint32_t:7) b7 = 0x0000007f,',
-                       '(uint32_t:4) four = 0x0000000f'])
+            substrs = ['(uint32_t:1) b1 = 1,',
+                       '(uint32_t:2) b2 = 3,',
+                       '(uint32_t:3) b3 = 7,',
+                       '(uint32_t:4) b4 = 15,',
+                       '(uint32_t:5) b5 = 31,',
+                       '(uint32_t:6) b6 = 63,',
+                       '(uint32_t:7) b7 = 127,',
+                       '(uint32_t:4) four = 15'])
 
         # And so should this.
         # rdar://problem/8348251
         self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
-            substrs = ['(uint32_t:1) b1 = 0x00000001,',
-                       '(uint32_t:2) b2 = 0x00000003,',
-                       '(uint32_t:3) b3 = 0x00000007,',
-                       '(uint32_t:4) b4 = 0x0000000f,',
-                       '(uint32_t:5) b5 = 0x0000001f,',
-                       '(uint32_t:6) b6 = 0x0000003f,',
-                       '(uint32_t:7) b7 = 0x0000007f,',
-                       '(uint32_t:4) four = 0x0000000f'])
+            substrs = ['(uint32_t:1) b1 = 1,',
+                       '(uint32_t:2) b2 = 3,',
+                       '(uint32_t:3) b3 = 7,',
+                       '(uint32_t:4) b4 = 15,',
+                       '(uint32_t:5) b5 = 31,',
+                       '(uint32_t:6) b6 = 63,',
+                       '(uint32_t:7) b7 = 127,',
+                       '(uint32_t:4) four = 15'])
 
     def bitfields_variable_python(self):
         """Use Python APIs to inspect a bitfields variable."""
@@ -113,24 +113,24 @@
         self.assertTrue(b1.GetName() == "b1" and
                         b1.GetTypeName() == "uint32_t:1" and
                         b1.IsInScope(frame) and
-                        int(b1.GetValue(frame), 16) == 0x01,
-                        'bits.b1 has type uint32_t:1, is in scope, and == 0x01')
+                        int(b1.GetValue(frame), 0) == 1,
+                        'bits.b1 has type uint32_t:1, is in scope, and == 1')
 
         b7 = bits.GetChildAtIndex(6)
         self.DebugSBValue(frame, b7)
         self.assertTrue(b7.GetName() == "b7" and
                         b7.GetTypeName() == "uint32_t:7" and
                         b7.IsInScope(frame) and
-                        int(b7.GetValue(frame), 16) == 0x7f,
-                        'bits.b7 has type uint32_t:7, is in scope, and == 0x7f')
+                        int(b7.GetValue(frame), 0) == 127,
+                        'bits.b7 has type uint32_t:7, is in scope, and == 127')
 
         four = bits.GetChildAtIndex(7)
         self.DebugSBValue(frame, four)
         self.assertTrue(four.GetName() == "four" and
                         four.GetTypeName() == "uint32_t:4" and
                         four.IsInScope(frame) and
-                        int(four.GetValue(frame), 16) == 0x0f,
-                        'bits.four has type uint32_t:4, is in scope, and == 0x0f')
+                        int(four.GetValue(frame), 0) == 15,
+                        'bits.four has type uint32_t:4, is in scope, and == 15')
 
         # Now kill the process, and we are done.
         rc = target.GetProcess().Kill()

Modified: lldb/trunk/test/set_values/TestSetValues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/set_values/TestSetValues.py?rev=114739&r1=114738&r2=114739&view=diff
==============================================================================
--- lldb/trunk/test/set_values/TestSetValues.py (original)
+++ lldb/trunk/test/set_values/TestSetValues.py Fri Sep 24 12:33:29 2010
@@ -65,7 +65,7 @@
         # main.c:36
         # Check that 'frame variable' displays the correct data type and value.
         self.expect("frame variable", VARIABLES_DISPLAYED_CORRECTLY,
-            startstr = "(short unsigned int) i = 0x0021")
+            startstr = "(short unsigned int) i = 33")
 
         # TODO:
         # Now set variable 'i' and check that it is correctly displayed.

Modified: lldb/trunk/test/unsigned_types/TestUnsignedTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/unsigned_types/TestUnsignedTypes.py?rev=114739&r1=114738&r2=114739&view=diff
==============================================================================
--- lldb/trunk/test/unsigned_types/TestUnsignedTypes.py (original)
+++ lldb/trunk/test/unsigned_types/TestUnsignedTypes.py Fri Sep 24 12:33:29 2010
@@ -45,11 +45,11 @@
         # Test that unsigned types display correctly.
         self.expect("frame variable -a", VARIABLES_DISPLAYED_CORRECTLY,
             startstr = "(unsigned char) the_unsigned_char = 'c'",
-            substrs = ["(short unsigned int) the_unsigned_short = 0x0063",
-                       "(unsigned int) the_unsigned_int = 0x00000063",
-                       "(long unsigned int) the_unsigned_long = 0x0000000000000063",
-                       "(long long unsigned int) the_unsigned_long_long = 0x0000000000000063",
-                       "(uint32_t) the_uint32 = 0x00000063"])
+            substrs = ["(short unsigned int) the_unsigned_short = 99",
+                       "(unsigned int) the_unsigned_int = 99",
+                       "(long unsigned int) the_unsigned_long = 99",
+                       "(long long unsigned int) the_unsigned_long_long = 99",
+                       "(uint32_t) the_uint32 = 99"])
 
 
 if __name__ == '__main__':





More information about the lldb-commits mailing list