[Lldb-commits] [lldb] r280478 - Revert "Make Scalar::GetValue more consistent"

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 2 02:52:19 PDT 2016


Author: labath
Date: Fri Sep  2 04:52:18 2016
New Revision: 280478

URL: http://llvm.org/viewvc/llvm-project?rev=280478&view=rev
Log:
Revert "Make Scalar::GetValue more consistent"

This reverts commit r280476 as it breaks several tests on i386. I was fixing an 32-bit
breakage, and I did not run the 32-bit test suite before submitting, oops.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py
    lldb/trunk/source/Core/Scalar.cpp
    lldb/trunk/unittests/Core/ScalarTest.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py?rev=280478&r1=280477&r2=280478&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py Fri Sep  2 04:52:18 2016
@@ -23,6 +23,7 @@ class MemoryFindTestCase(TestBase):
         # Find the line number to break inside main().
         self.line = line_number('main.cpp', '// break here')
 
+    @expectedFailureAll(archs=["i386", "arm"])
     def test_memory_find(self):
         """Test the 'memory find' command."""
         self.build()

Modified: lldb/trunk/source/Core/Scalar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Scalar.cpp?rev=280478&r1=280477&r2=280478&view=diff
==============================================================================
--- lldb/trunk/source/Core/Scalar.cpp (original)
+++ lldb/trunk/source/Core/Scalar.cpp Fri Sep  2 04:52:18 2016
@@ -308,16 +308,18 @@ Scalar::GetValue (Stream *s, bool show_t
     case e_void:
         break;
     case e_sint:
-    case e_slong:
+    case e_ulong:
     case e_slonglong:
     case e_sint128:
     case e_sint256:
+        s->Printf("%s",m_integer.toString(10,true).c_str());
+        break;
     case e_uint:
-    case e_ulong:
+    case e_slong:
     case e_ulonglong:
     case e_uint128:
     case e_uint256:
-        s->PutCString(m_integer.toString(10, true).c_str());
+        s->Printf("%s",m_integer.toString(16,false).c_str());
         break;
     case e_float:
     case e_double:

Modified: lldb/trunk/unittests/Core/ScalarTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Core/ScalarTest.cpp?rev=280478&r1=280477&r2=280478&view=diff
==============================================================================
--- lldb/trunk/unittests/Core/ScalarTest.cpp (original)
+++ lldb/trunk/unittests/Core/ScalarTest.cpp Fri Sep  2 04:52:18 2016
@@ -19,7 +19,6 @@
 #include "lldb/Core/Scalar.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Host/Endian.h"
-#include "lldb/Core/StreamString.h"
 
 using namespace lldb_private;
 
@@ -104,31 +103,3 @@ TEST(ScalarTest, ExtractBitfield)
     ASSERT_TRUE(u_scalar.ExtractBitfield(len - 4, 4));
     ASSERT_EQ(0, memcmp(&b2, u_scalar.GetBytes(), sizeof(b2)));
 }
-
-template <typename T>
-static std::string
-ScalarGetValue(T value)
-{
-    StreamString stream;
-    Scalar(value).GetValue(&stream, false);
-    return stream.GetString();
-}
-
-TEST(ScalarTest, GetValue)
-{
-    EXPECT_EQ("12345", ScalarGetValue<signed short>(12345));
-    EXPECT_EQ("-12345", ScalarGetValue<signed short>(-12345));
-    EXPECT_EQ("12345", ScalarGetValue<unsigned short>(12345));
-
-    EXPECT_EQ("12345", ScalarGetValue<signed int>(12345));
-    EXPECT_EQ("-12345", ScalarGetValue<signed int>(-12345));
-    EXPECT_EQ("12345", ScalarGetValue<unsigned int>(12345));
-
-    EXPECT_EQ("12345678", ScalarGetValue<signed long>(12345678L));
-    EXPECT_EQ("-12345678", ScalarGetValue<signed long>(-12345678L));
-    EXPECT_EQ("12345678", ScalarGetValue<unsigned long>(12345678UL));
-
-    EXPECT_EQ("1234567890123", ScalarGetValue<signed long long>(1234567890123LL));
-    EXPECT_EQ("-1234567890123", ScalarGetValue<signed long long>(-1234567890123LL));
-    EXPECT_EQ("1234567890123", ScalarGetValue<unsigned long long>(1234567890123ULL));
-}




More information about the lldb-commits mailing list