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 9f14914753.
This commit is contained in:
jimingham
2024-04-12 10:51:49 -07:00
committed by GitHub
parent 9022d9c102
commit 4b0beb4f5e
2 changed files with 25 additions and 3 deletions

View File

@@ -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()