Skip to content

Commit 267ad8b

Browse files
DavidSpickettgithub-actions[bot]
authored andcommitted
Automerge: [lldb] Add more ARM checks in TestLldbGdbServer.py (#130277)
When llvm/llvm-project#130034 enabled RISC-V here I noticed that these should run for ARM as well. ARM only has 4 argument registers, which matches Arm's ABI for it: https://github.com/ARM-software/abi-aa/blob/main/aapcs32/aapcs32.rst#core-registers The ABI defines a link register LR, and I assume that's what becomes 'ra' in LLDB. Tested on ARM and AArch64 Linux.
2 parents db0df6f + fe544d4 commit 267ad8b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,13 @@ def isAArch64(self):
13441344
arch = self.getArchitecture().lower()
13451345
return arch in ["aarch64", "arm64", "arm64e"]
13461346

1347+
def isARM(self):
1348+
"""Returns true if the architecture is ARM, meaning 32-bit ARM. Which could
1349+
be M profile, A profile Armv7-a, or the AArch32 mode of Armv8-a."""
1350+
return not self.isAArch64() and (
1351+
self.getArchitecture().lower().startswith("arm")
1352+
)
1353+
13471354
def isAArch64SVE(self):
13481355
return self.isAArch64() and "sve" in self.getCPUInfo()
13491356

lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ def test_qRegisterInfo_contains_required_generics_debugserver(self):
199199
if not self.isRISCV():
200200
self.assertIn("flags", generic_regs)
201201

202-
if self.isRISCV():
203-
# Special RISC-V register for a return address
202+
if self.isRISCV() or self.isAArch64() or self.isARM():
203+
# Specific register for a return address
204204
self.assertIn("ra", generic_regs)
205205

206-
# RISC-V's function arguments registers
207-
for i in range(1, 9):
206+
# Function arguments registers
207+
for i in range(1, 5 if self.isARM() else 9):
208208
self.assertIn(f"arg{i}", generic_regs)
209209

210210
def test_qRegisterInfo_contains_at_least_one_register_set(self):

0 commit comments

Comments
 (0)