[Lldb-commits] [PATCH] D15061: Correction in TestFrames.py test for arm targets in thumb mode

Muhammad Omair Javaid via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 29 17:08:34 PST 2015


omjavaid created this revision.
omjavaid added a reviewer: tberghammer.
omjavaid added a subscriber: lldb-commits.
Herald added subscribers: rengolin, aemerson.

This patch adds required correction in TestFrames.py for arm targets in thumb mode.

On arm hardware thumb mode is identified by setting the least significant bit. In such case when we read PC we ll end up getting an unaligned address which has last bit set and will cause a mismatch between address read from dwarf frame information. I have corrected this by adding an appropriate check in TestFrames.py.



http://reviews.llvm.org/D15061

Files:
  packages/Python/lldbsuite/test/python_api/frame/TestFrames.py

Index: packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
===================================================================
--- packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
+++ packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
@@ -80,9 +80,12 @@
                 gpr_reg_set = lldbutil.get_GPRs(frame)
                 pc_value = gpr_reg_set.GetChildMemberWithName("pc")
                 self.assertTrue (pc_value, "We should have a valid PC.")
-                pc_value_str = pc_value.GetValue()
-                self.assertTrue (pc_value_str, "We should have a valid PC string.")
-                self.assertTrue (int(pc_value_str, 0) == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
+                pc_value_int = int(pc_value.GetValue(), 0)
+                # Make sure on arm targets we dont mismatch PC value on the basis of thumb bit.
+                # Frame PC will not have thumb bit set in case of a thumb instruction as PC.
+                if self.getArchitecture() in ['arm']:
+                    pc_value_int &= ~1
+                self.assertTrue (pc_value_int == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
                 sp_value = gpr_reg_set.GetChildMemberWithName("sp")
                 self.assertTrue (sp_value, "We should have a valid Stack Pointer.")
                 self.assertTrue (int(sp_value.GetValue(), 0) == frame.GetSP(), "SP gotten as a value should equal frame's GetSP")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15061.41359.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151130/1fff1e48/attachment.bin>


More information about the lldb-commits mailing list