Skip to content

[lldb] Update two API tests to fix x86 Darwin failures #121380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jasonmolenda
Copy link
Collaborator

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Dec 31, 2024

@llvm/pr-subscribers-lldb

Author: Jason Molenda (jasonmolenda)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/121380.diff

2 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py (+11-1)
  • (modified) lldb/test/API/commands/register/register/register_command/TestRegisters.py (+7)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index d6cb68f55bf296..cbe430c92fa7fb 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -1410,7 +1410,17 @@ def read_register_values(self, reg_infos, endian, thread_id=None):
             p_response = context.get("p_response")
             self.assertIsNotNone(p_response)
             self.assertTrue(len(p_response) > 0)
-            self.assertFalse(p_response[0] == "E")
+
+            # on x86 Darwin, 4 GPR registers are often
+            # unavailable, this is expected and correct.
+            if (
+                self.getArchitecture() == "x86_64"
+                and self.platformIsDarwin()
+                and p_response[0] == "E"
+            ):
+                values[reg_index] = 0
+            else:
+                self.assertFalse(p_response[0] == "E")
 
             values[reg_index] = unpack_register_hex_unsigned(endian, p_response)
 
diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
index 0b80a09534371e..99290e02cd2b04 100644
--- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -58,6 +58,13 @@ def test_register_commands(self):
             # could not be read.  This is expected.
             error_str_matched = True
 
+        if self.getArchitecture() == "x86_64" and self.platformIsDarwin():
+            # debugserver on x86 will provide ds/es/ss/gsbase when the
+            # kernel provides them, but most of the time they will be
+            # unavailable.  So "register read -a" will report that
+            # 4 registers were unavailable, it is expected.
+            error_str_matched = True
+
         self.expect(
             "register read -a",
             MISSING_EXPECTED_REGISTERS,

@jasonmolenda
Copy link
Collaborator Author

FTR I was looking at Brendan's PR before we merged it, and I'm sure I ran the testsuite, but I must have missed these two fails when running the testsuite with a locally-built debugserver.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jasonmolenda jasonmolenda merged commit 5056a4b into llvm:main Dec 31, 2024
9 checks passed
@jasonmolenda jasonmolenda deleted the handle-unavailable-gprs-on-intel-darwin branch December 31, 2024 18:48
jasonmolenda added a commit to jasonmolenda/llvm-project that referenced this pull request Jan 14, 2025
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)
JDevlieghere added a commit to swiftlang/llvm-project that referenced this pull request Jan 15, 2025
…intel-debugserver

[lldb] Update two API tests to fix x86 Darwin failures (llvm#121380)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants