aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorjimingham <jingham@apple.com>2024-04-12 10:51:49 -0700
committerGitHub <noreply@github.com>2024-04-12 10:51:49 -0700
commit4b0beb4f5ec42aea58461df7994e2fa40f335bb6 (patch)
tree2c6b1591b95c84eee2b452c573477e74ec163fd7 /lldb/test/API/python_api
parent9022d9c102a8c47616fbeb6a45b015db6bd2c17a (diff)
downloadllvm-4b0beb4f5ec42aea58461df7994e2fa40f335bb6.zip
llvm-4b0beb4f5ec42aea58461df7994e2fa40f335bb6.tar.gz
llvm-4b0beb4f5ec42aea58461df7994e2fa40f335bb6.tar.bz2
Reapply "Fix error in unrecognized register name handling for "SBFram…e.register"" (#88468)" (#88535)
The only change is a fix for the "register" iterator test to not rely on particular register names. I mistook where the artificial "pc" register is generated. It isn't added to the register list or the register sets (except on arm where that's the name of the actual register), so I can't use it in this test. I instead just assert that the "register" generator produces the same list as flattening the register sets from "registers". This reverts commit 9f14914753599f3879e4c273191959e2f1b3632c.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/frame/TestFrames.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/lldb/test/API/python_api/frame/TestFrames.py b/lldb/test/API/python_api/frame/TestFrames.py
index a82b129..0ec1220 100644
--- a/lldb/test/API/python_api/frame/TestFrames.py
+++ b/lldb/test/API/python_api/frame/TestFrames.py
@@ -73,10 +73,12 @@ class FrameAPITestCase(TestBase):
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_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.
+ pc_value_int = int(pc_value.GetValue(), 0)
if self.getArchitecture() in ["arm", "armv7", "armv7k"]:
pc_value_int &= ~1
self.assertEqual(
@@ -91,7 +93,17 @@ class FrameAPITestCase(TestBase):
frame.GetSP(),
"SP gotten as a value should equal frame's GetSP",
)
-
+ # Test that the "register" property's flat list matches the list from
+ # the "registers" property that returns register sets:
+ register_regs = set()
+ flattened_regs = set()
+ for reg_set in frame.registers:
+ for reg in reg_set:
+ flattened_regs.add(reg.name)
+ for reg in frame.register:
+ register_regs.add(reg.name)
+ self.assertEqual(register_regs, flattened_regs, "register matches registers")
+
print("---", file=session)
process.Continue()