Skip to content

[lldb] Ignore registers that the debugserver fails to read #132122

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
merged 1 commit into from
Mar 21, 2025

Conversation

rocallahan
Copy link
Contributor

On Mac x86-64, the debugserver reports a register ('ds' at least) but returns an error when we try to read it. Just skip storing such registers in snapshots so we won't try to restore them.

On Mac x86-64, the debugserver reports a register ('ds' at least)
but returns an error when we try to read it. Just skip storing such
registers in snapshots so we won't try to restore them.
@llvmbot
Copy link
Member

llvmbot commented Mar 19, 2025

@llvm/pr-subscribers-lldb

Author: Robert O'Callahan (rocallahan)

Changes

On Mac x86-64, the debugserver reports a register ('ds' at least) but returns an error when we try to read it. Just skip storing such registers in snapshots so we won't try to restore them.


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

3 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/lldbreverse.py (+4-1)
  • (modified) lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py (-8)
  • (modified) lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py (-4)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbreverse.py b/lldb/packages/Python/lldbsuite/test/lldbreverse.py
index a42cc7cac15d3..d9a8daba3772d 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbreverse.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbreverse.py
@@ -300,7 +300,10 @@ def capture_snapshot(self):
             for index in sorted(self.general_purpose_register_info.keys()):
                 reply = self.pass_through(f"p{index:x};thread:{thread_id:x};")
                 if reply == "" or reply[0] == "E":
-                    raise ValueError("Can't read register")
+                    # Mac debugserver tells us about registers that it won't let
+                    # us actually read. Ignore those registers.
+                    self.logger.debug(f"Failed to read register {index:x}")
+                    continue
                 registers[index] = reply
             thread_snapshot = ThreadSnapshot(thread_id, registers)
             thread_sp = self.get_register(
diff --git a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
index 1ff645b94d2eb..a159e0f716dbe 100644
--- a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
+++ b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py
@@ -11,13 +11,11 @@
 class TestReverseContinueBreakpoints(ReverseTestBase):
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue(self):
         self.reverse_continue_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_async(self):
         self.reverse_continue_internal(async_mode=True)
 
@@ -47,13 +45,11 @@ def reverse_continue_internal(self, async_mode):
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_breakpoint(self):
         self.reverse_continue_breakpoint_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_breakpoint_async(self):
         self.reverse_continue_breakpoint_internal(async_mode=True)
 
@@ -72,13 +68,11 @@ def reverse_continue_breakpoint_internal(self, async_mode):
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_skip_breakpoint(self):
         self.reverse_continue_skip_breakpoint_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_skip_breakpoint_async(self):
         self.reverse_continue_skip_breakpoint_internal(async_mode=True)
 
@@ -104,13 +98,11 @@ def reverse_continue_skip_breakpoint_internal(self, async_mode):
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_continue_preserves_direction(self):
         self.continue_preserves_direction_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_continue_preserves_direction_asyhc(self):
         self.continue_preserves_direction_internal(async_mode=True)
 
diff --git a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
index 519f1cb23604d..c942f2a0386e5 100644
--- a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
+++ b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py
@@ -11,13 +11,11 @@
 class TestReverseContinueWatchpoints(ReverseTestBase):
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_watchpoint(self):
         self.reverse_continue_watchpoint_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_watchpoint_async(self):
         self.reverse_continue_watchpoint_internal(async_mode=True)
 
@@ -63,13 +61,11 @@ def reverse_continue_watchpoint_internal(self, async_mode):
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_skip_watchpoint(self):
         self.reverse_continue_skip_watchpoint_internal(async_mode=False)
 
     @skipIfRemote
     @skipIf(macos_version=["<", "15.0"])
-    @skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"])
     def test_reverse_continue_skip_watchpoint_async(self):
         self.reverse_continue_skip_watchpoint_internal(async_mode=True)
 

@rocallahan
Copy link
Contributor Author

@labath can someone merge this for me? Thanks!

@labath labath merged commit f89a7fa into llvm:main Mar 21, 2025
12 checks passed
@rocallahan rocallahan deleted the skip-bad-register branch March 21, 2025 21:52
@jasonmolenda
Copy link
Collaborator

FWIW this is a change from September, #108663 , where debugserver can report DS, ES, SS, GSbase contents when the kernel provides them. But they are most often not available, so reads will fail.

labath added a commit to labath/llvm-project that referenced this pull request Mar 27, 2025
The x86-specific issue has been fixed with llvm#132122. Watchpoint tests
fail on aarch64 with macos<15.0 due to a kernel bug.
DavidSpickett pushed a commit that referenced this pull request Mar 28, 2025
The x86-specific issue has been fixed with #132122. Watchpoint tests
fail on aarch64 with macos<15.0 due to a kernel bug.
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.

5 participants