[Lldb-commits] [PATCH] D14611: Remove a broken hack from Scalar::ULongLong and fix a test

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 12 04:45:02 PST 2015


tberghammer created this revision.
tberghammer added reviewers: clayborg, granata.enrico.
tberghammer added a subscriber: lldb-commits.

Remove a broken hack from Scalar::ULongLong and fix a test

Change Test-rdar-12481949.py to expect GetValueAsUnsigned() to return
0xffffffff if the variable is an int32_t (signed, 4 byte integer) with
value of -1. The previous expectation where we expected the value to be
0xffffffffffffffff doesn't make sense as nothing explains why we would
treat it as an 8 byte value.

This CL also removes a hack from Scalar::ULongLong what was most likely
added to get this test passing as it only worked in case the value of
the variable is -1 and didn't make any sense even in that case.

http://reviews.llvm.org/D14611

Files:
  packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
  source/Core/Scalar.cpp

Index: source/Core/Scalar.cpp
===================================================================
--- source/Core/Scalar.cpp
+++ source/Core/Scalar.cpp
@@ -1574,8 +1574,6 @@
     case e_ulonglong:
     case e_sint128:
     case e_uint128:
-        if(m_integer.isAllOnesValue())
-            return *(const ulonglong_t *)(llvm::APInt::getAllOnesValue(128)).getRawData();
         return *(const ulonglong_t *)m_integer.getRawData();
     case e_float:
         return (ulonglong_t)m_float.convertToFloat();
Index: packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
+++ packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
@@ -50,5 +50,5 @@
         self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFFFFFFFFFF, "GetValueAsSigned() does not say 0xFFFFFFFFFFFFFFFF")
 
         self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1, "GetValueAsUnsigned() does not say -1")
-        self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFFFFFFFFFF, "GetValueAsUnsigned() says 0xFFFFFFFFFFFFFFFF")
-        self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF, "GetValueAsUnsigned() does not say 0xFFFFFFFF")
+        self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFF, "GetValueAsUnsigned() says 0xFFFFFFFF")
+        self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != 0xFFFFFFFFFFFFFFFF, "GetValueAsUnsigned() does not says 0xFFFFFFFFFFFFFFFF")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14611.40031.patch
Type: text/x-patch
Size: 1719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151112/982ca8a4/attachment.bin>


More information about the lldb-commits mailing list