Skip to content

Commit 00574ac

Browse files
committed
[lldb] Update two API tests to fix x86 Darwin failures (llvm#121380)
The Intel Darwin CI bots had their Xcode updated, which brought in a debugserver with Brendan Shanks' change from September 7281e0c llvm#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. (cherry picked from commit 5056a4b)
1 parent 9c7f25b commit 00574ac

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
@@ -1408,7 +1408,17 @@ def read_register_values(self, reg_infos, endian, thread_id=None):
14081408
p_response = context.get("p_response")
14091409
self.assertIsNotNone(p_response)
14101410
self.assertTrue(len(p_response) > 0)
1411-
self.assertFalse(p_response[0] == "E")
1411+
1412+
# on x86 Darwin, 4 GPR registers are often
1413+
# unavailable, this is expected and correct.
1414+
if (
1415+
self.getArchitecture() == "x86_64"
1416+
and self.platformIsDarwin()
1417+
and p_response[0] == "E"
1418+
):
1419+
values[reg_index] = 0
1420+
else:
1421+
self.assertFalse(p_response[0] == "E")
14121422

14131423
values[reg_index] = unpack_register_hex_unsigned(endian, p_response)
14141424

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)