Index: lldb/packages/Python/lldbsuite/test/decorators.py =================================================================== --- lldb/packages/Python/lldbsuite/test/decorators.py +++ lldb/packages/Python/lldbsuite/test/decorators.py @@ -826,3 +826,18 @@ return (('DYLD_INSERT_LIBRARIES' in os.environ) and 'libclang_rt.asan' in os.environ['DYLD_INSERT_LIBRARIES']) return skipTestIfFn(is_sanitized)(func) + +def skipIfDbRegsReadOnly(func): + """Skip this test if platform does not permit writing to debug registers.""" + def is_dbregs_rdonly(): + if platform.system() != 'NetBSD': + return None + try: + output = subprocess.check_output(["/sbin/sysctl", "-n", + "security.models.extensions.user_set_dbregs"]).decode().strip() + if output == "1": + return None + except subprocess.CalledProcessError: + pass + return "security.models.extensions.user_set_dbregs is disabled" + return skipTestIfFn(is_dbregs_rdonly)(func) Index: lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py +++ lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py @@ -71,6 +71,7 @@ @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @skipIfDbRegsReadOnly def test_watchpoint_multiple_threads_wp_set_and_then_delete(self): """Test that lldb watchpoint works for multiple threads, and after the watchpoint is deleted, the watchpoint event should no longer fires.""" self.build() Index: lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py +++ lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py @@ -113,6 +113,7 @@ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") # Read-write watchpoints not supported on SystemZ @expectedFailureAll(archs=['s390x']) + @skipIfDbRegsReadOnly def test_rw_watchpoint_delete(self): """Test delete watchpoint and expect not to stop for watchpoint.""" self.build(dictionary=self.d) Index: lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py +++ lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_disable/TestWatchpointDisable.py @@ -19,6 +19,7 @@ @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @skipIfDbRegsReadOnly def test_disable_works (self): """Set a watchpoint, disable it, and make sure it doesn't get hit.""" self.build() Index: lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py +++ lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_events/TestWatchpointEvents.py @@ -29,6 +29,7 @@ @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @skipIfDbRegsReadOnly def test_with_python_api(self): """Test that adding, deleting and modifying watchpoints sends the appropriate events.""" self.build() Index: lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py =================================================================== --- lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py +++ lldb/packages/Python/lldbsuite/test/functionalities/watchpoint/watchpoint_on_vectors/TestValueOfVectorVariable.py @@ -20,6 +20,7 @@ @expectedFailureAll( oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows") + @skipIfDbRegsReadOnly def test_value_of_vector_variable_using_watchpoint_set(self): """Test verify displayed value of vector variable.""" exe = self.getBuildArtifact("a.out")