Skip to content

Commit 5056a4b

Browse files
authored
[lldb] Update two API tests to fix x86 Darwin failures (#121380)
The Intel Darwin CI bots had their Xcode updated, which brought in a debugserver with Brendan Shanks' change from September 7281e0c #108663 where four general purpose registers are sent by debugserver when in certain process states. But most processes (nearly all in the testsuite) do not have these registers available, so we will get register read failures when requesting those four. These two tests would flag those as errors. There would have been an additional problem with the g/G packet (which lldb doesn't use w/ debugserver, but the testsuite tests) if placeholder values were not included in the full register context bytes; I fixed that issue with the SME patch to debugserver recently already.
1 parent 2cee903 commit 5056a4b

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,17 @@ def read_register_values(self, reg_infos, endian, thread_id=None):
14101410
p_response = context.get("p_response")
14111411
self.assertIsNotNone(p_response)
14121412
self.assertTrue(len(p_response) > 0)
1413-
self.assertFalse(p_response[0] == "E")
1413+
1414+
# on x86 Darwin, 4 GPR registers are often
1415+
# unavailable, this is expected and correct.
1416+
if (
1417+
self.getArchitecture() == "x86_64"
1418+
and self.platformIsDarwin()
1419+
and p_response[0] == "E"
1420+
):
1421+
values[reg_index] = 0
1422+
else:
1423+
self.assertFalse(p_response[0] == "E")
14141424

14151425
values[reg_index] = unpack_register_hex_unsigned(endian, p_response)
14161426

lldb/test/API/commands/register/register/register_command/TestRegisters.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ def test_register_commands(self):
5858
# could not be read. This is expected.
5959
error_str_matched = True
6060

61+
if self.getArchitecture() == "x86_64" and self.platformIsDarwin():
62+
# debugserver on x86 will provide ds/es/ss/gsbase when the
63+
# kernel provides them, but most of the time they will be
64+
# unavailable. So "register read -a" will report that
65+
# 4 registers were unavailable, it is expected.
66+
error_str_matched = True
67+
6168
self.expect(
6269
"register read -a",
6370
MISSING_EXPECTED_REGISTERS,

0 commit comments

Comments
 (0)