[llvm-branch-commits] [lldb] 4be8a7b - [lldb] Fix TestVTableValue on 32 bit

David Spickett via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 3 13:41:02 PDT 2023


Author: David Spickett
Date: 2023-11-03T10:36:39Z
New Revision: 4be8a7bda55c5b50832b773b204f75cd26c5979d

URL: https://github.com/llvm/llvm-project/commit/4be8a7bda55c5b50832b773b204f75cd26c5979d
DIFF: https://github.com/llvm/llvm-project/commit/4be8a7bda55c5b50832b773b204f75cd26c5979d.diff

LOG: [lldb] Fix TestVTableValue on 32 bit

7fbd427f5ebea4a4ebf25747758851875bb7e173 added a test that overwrites
a vtable entry but it uses and expects a 64 bit value. Add the 32 bit
equivalents.

Added: 
    

Modified: 
    lldb/test/API/functionalities/vtable/TestVTableValue.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/vtable/TestVTableValue.py b/lldb/test/API/functionalities/vtable/TestVTableValue.py
index 5b243e0646f4c28..1c238ad60739bd9 100644
--- a/lldb/test/API/functionalities/vtable/TestVTableValue.py
+++ b/lldb/test/API/functionalities/vtable/TestVTableValue.py
@@ -132,13 +132,19 @@ def test_overwrite_vtable(self):
         # Overwrite the first entry in the vtable and make sure we can still
         # see the bogus value which should have no summary
         vtable_addr = vtable.GetValueAsUnsigned()
-        data = str("\x01\x01\x01\x01\x01\x01\x01\x01")
+
+        is_64bit = self.process().GetAddressByteSize() == 8
+        data = str(
+            "\x01\x01\x01\x01\x01\x01\x01\x01" if is_64bit else "\x01\x01\x01\x01"
+        )
         error = lldb.SBError()
         process.WriteMemory(vtable_addr, data, error)
 
         scribbled_child = vtable.GetChildAtIndex(0)
-        self.assertEquals(scribbled_child.GetValueAsUnsigned(0),
-                          0x0101010101010101)
+        self.assertEquals(
+            scribbled_child.GetValueAsUnsigned(0),
+            0x0101010101010101 if is_64bit else 0x01010101,
+        )
         self.assertEquals(scribbled_child.GetSummary(), None)
 
     def expected_vtable_addr(self, var: lldb.SBValue) -> int:


        


More information about the llvm-branch-commits mailing list