mgorny created this revision.
mgorny added reviewers: labath, krytarowski, emaste.
Herald added a subscriber: arichardson.
Herald added a reviewer: JDevlieghere.
mgorny requested review of this revision.

The new FreeBSDRemote plugin has reached feature parity on i386
and amd64 targets.  Use it by default on these architectures, while
allowing the use of the legacy plugin via FREEBSD_LEGACY_PLUGIN envvar.

Revisit the method of switching plugins.  Apparently, the return value
of PlatformFreeBSD::CanDebugProcess() is what really decides whether
the legacy or the new plugin is used.

Update the test status.  Reenable the tests that were previously
disabled on FreeBSD and do not cause hangs or are irrelevant to FreeBSD.
Mark all tests that fail reliably as expectedFailure.  For now, tests
that are flaky (i.e. produce unstable results) are left enabled
and cause unpredictable test failures.


https://reviews.llvm.org/D90757

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
  lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
  lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
  lldb/test/API/commands/expression/formatters/TestFormatters.py
  lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
  lldb/test/API/commands/register/register/register_command/TestRegisters.py
  
lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
  lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
  
lldb/test/API/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
  lldb/test/API/functionalities/deleted-executable/TestDeletedExecutable.py
  lldb/test/API/functionalities/exec/TestExec.py
  lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
  lldb/test/API/functionalities/inferior-crashing/TestInferiorCrashingStep.py
  
lldb/test/API/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferiorStep.py
  lldb/test/API/functionalities/load_unload/TestLoadUnload.py
  lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
  lldb/test/API/functionalities/longjmp/TestLongjmp.py
  
lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
  lldb/test/API/functionalities/signal/TestSendSignal.py
  lldb/test/API/functionalities/signal/raise/TestRaise.py
  
lldb/test/API/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
  lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
  lldb/test/API/functionalities/thread/state/TestThreadStates.py
  lldb/test/API/lang/c/modules/TestCModules.py
  lldb/test/API/lit.cfg.py
  lldb/test/API/python_api/event/TestEvents.py
  lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
  lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
  lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py
  
lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
  lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
  lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
  lldb/test/Shell/ExecControl/StopHook/stop-hook-threads.test
  lldb/test/Shell/Recognizer/assert.test
  lldb/test/Shell/lit.cfg.py

Index: lldb/test/Shell/lit.cfg.py
===================================================================
--- lldb/test/Shell/lit.cfg.py
+++ lldb/test/Shell/lit.cfg.py
@@ -135,4 +135,4 @@
     config.available_features.add('dbregs-set')
 
 # pass control variable through
-llvm_config.with_system_environment('FREEBSD_REMOTE_PLUGIN')
+llvm_config.with_system_environment('FREEBSD_LEGACY_PLUGIN')
Index: lldb/test/Shell/Recognizer/assert.test
===================================================================
--- lldb/test/Shell/Recognizer/assert.test
+++ lldb/test/Shell/Recognizer/assert.test
@@ -1,4 +1,5 @@
 # XFAIL: target-arm && linux-gnu
+# XFAIL: system-freebsd
 # UNSUPPORTED: system-windows
 # RUN: %clang_host -g -O0 %S/Inputs/assert.c -o %t.out
 # RUN: %lldb -b -s %s %t.out | FileCheck %s
Index: lldb/test/Shell/ExecControl/StopHook/stop-hook-threads.test
===================================================================
--- lldb/test/Shell/ExecControl/StopHook/stop-hook-threads.test
+++ lldb/test/Shell/ExecControl/StopHook/stop-hook-threads.test
@@ -3,6 +3,7 @@
 # RUN:     | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
 # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \
 # RUN:     | FileCheck --check-prefix=CHECK --check-prefix=CHECK-FILTER %s
+# XFAIL: system-freebsd
 # XFAIL: system-netbsd
 # UNSUPPORTED: system-windows
 # This test is flakey and hangs on windows periodically: llvm.org/pr38373
Index: lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
===================================================================
--- lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ lldb/test/API/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -29,6 +29,7 @@
         self.assertEqual(expected_name, kv_dict.get("name"))
 
     @skipIfWindows # the test is not updated for Windows.
+    @expectedFailureAll(oslist=["freebsd"])
     @llgs_test
     def test(self):
         """ Make sure lldb-server can retrieve inferior thread name"""
Index: lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
===================================================================
--- lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
+++ lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
@@ -136,7 +136,7 @@
         self.assertEqual(
             ['0x727476787a7c7e71', '0x737577797b7d7f70'], get_reg_value('xmm15'))
 
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_g_returns_correct_data_with_suffix_llgs(self):
         self.init_llgs_test()
@@ -144,7 +144,7 @@
         self.set_inferior_startup_launch()
         self.g_returns_correct_data(True)
 
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_g_returns_correct_data_no_suffix_llgs(self):
         self.init_llgs_test()
Index: lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
===================================================================
--- lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
+++ lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
@@ -106,27 +106,27 @@
             self.assertIn(os.path.realpath(self.getBuildDir() + "/" + lib), libraries_svr4_names)
 
     @llgs_test
-    @skipUnlessPlatform(["linux", "android", "netbsd"])
+    @skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
     def test_supports_libraries_svr4(self):
         self.setup_test()
         self.assertTrue(self.has_libraries_svr4_support())
 
     @llgs_test
-    @skipUnlessPlatform(["linux", "android", "netbsd"])
+    @skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
     @expectedFailureNetBSD
     def test_libraries_svr4_well_formed(self):
         self.setup_test()
         self.libraries_svr4_well_formed()
 
     @llgs_test
-    @skipUnlessPlatform(["linux", "android", "netbsd"])
-    @expectedFailureNetBSD
+    @skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     def test_libraries_svr4_load_addr(self):
         self.setup_test()
         self.libraries_svr4_has_correct_load_addr()
 
     @llgs_test
-    @skipUnlessPlatform(["linux", "android", "netbsd"])
+    @skipUnlessPlatform(["linux", "android", "freebsd", "netbsd"])
     @expectedFailureNetBSD
     def test_libraries_svr4_libs_present(self):
         self.setup_test()
Index: lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py
===================================================================
--- lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py
+++ lldb/test/API/tools/lldb-server/commandline/TestStubSetSID.py
@@ -49,7 +49,6 @@
     @skipIfWindows
     @llgs_test
     @skipIfRemote  # --setsid not used on remote platform and currently it is also impossible to get the sid of lldb-platform running on a remote target
-    @expectedFailureAll(oslist=['freebsd'])
     def test_sid_is_same_without_setsid_llgs(self):
         self.init_llgs_test()
         self.set_inferior_startup_launch()
Index: lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -434,7 +434,7 @@
             "Advanced Vector Extensions" in register_sets)
 
     @expectedFailureAll(oslist=["windows"]) # no avx for now.
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_qRegisterInfo_contains_avx_registers_llgs(self):
         self.init_llgs_test()
@@ -604,7 +604,7 @@
         self.set_inferior_startup_launch()
         self.p_returns_correct_data_size_for_each_qRegisterInfo()
 
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_p_returns_correct_data_size_for_each_qRegisterInfo_launch_llgs(
             self):
@@ -622,7 +622,7 @@
         self.set_inferior_startup_attach()
         self.p_returns_correct_data_size_for_each_qRegisterInfo()
 
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_llgs(
             self):
@@ -819,7 +819,7 @@
         self.Hc_then_Csignal_signals_correct_thread(self.TARGET_EXC_BAD_ACCESS)
 
     @skipIfWindows # no SIGSEGV support
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_Hc_then_Csignal_signals_correct_thread_launch_llgs(self):
         self.init_llgs_test()
@@ -916,6 +916,7 @@
         self.qMemoryRegionInfo_is_supported()
 
     @llgs_test
+    @expectedFailureAll(oslist=["freebsd"])
     def test_qMemoryRegionInfo_is_supported_llgs(self):
         self.init_llgs_test()
         self.build()
@@ -980,6 +981,7 @@
         self.qMemoryRegionInfo_reports_code_address_as_executable()
 
     @skipIfWindows # No pty support to test any inferior output
+    @expectedFailureAll(oslist=["freebsd"])
     @llgs_test
     def test_qMemoryRegionInfo_reports_code_address_as_executable_llgs(self):
         self.init_llgs_test()
@@ -1046,6 +1048,7 @@
         self.qMemoryRegionInfo_reports_stack_address_as_readable_writeable()
 
     @skipIfWindows # No pty support to test any inferior output
+    @expectedFailureAll(oslist=["freebsd"])
     @llgs_test
     def test_qMemoryRegionInfo_reports_stack_address_as_readable_writeable_llgs(
             self):
@@ -1112,6 +1115,7 @@
         self.qMemoryRegionInfo_reports_heap_address_as_readable_writeable()
 
     @skipIfWindows # No pty support to test any inferior output
+    @expectedFailureAll(oslist=["freebsd"])
     @llgs_test
     def test_qMemoryRegionInfo_reports_heap_address_as_readable_writeable_llgs(
             self):
Index: lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
@@ -163,7 +163,7 @@
         self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
             self.THREAD_COUNT)
 
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     @llgs_test
     def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(
             self):
Index: lldb/test/API/python_api/event/TestEvents.py
===================================================================
--- lldb/test/API/python_api/event/TestEvents.py
+++ lldb/test/API/python_api/event/TestEvents.py
@@ -197,12 +197,12 @@
         self.assertTrue(event,
                         "My listening thread successfully received an event")
 
-    @skipIfFreeBSD  # llvm.org/pr21325
     @add_test_categories(['pyapi'])
     @expectedFailureAll(
         oslist=["linux"],
         bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
     @skipIfWindows # This is flakey on Windows AND when it fails, it hangs: llvm.org/pr38373
+    @expectedFailureAll(oslist=["freebsd"])
     @expectedFlakeyNetBSD
     def test_add_listener_to_broadcaster(self):
         """Exercise some SBBroadcaster APIs."""
Index: lldb/test/API/lit.cfg.py
===================================================================
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -258,7 +258,7 @@
 # testFormat: The test format to use to interpret tests.
 config.test_format = lldbtest.LLDBTest(dotest_cmd)
 
-# Propagate FREEBSD_REMOTE_PLUGIN
-if 'FREEBSD_REMOTE_PLUGIN' in os.environ:
-  config.environment['FREEBSD_REMOTE_PLUGIN'] = os.environ[
-      'FREEBSD_REMOTE_PLUGIN']
+# Propagate FREEBSD_LEGACY_PLUGIN
+if 'FREEBSD_LEGACY_PLUGIN' in os.environ:
+  config.environment['FREEBSD_LEGACY_PLUGIN'] = os.environ[
+      'FREEBSD_LEGACY_PLUGIN']
Index: lldb/test/API/lang/c/modules/TestCModules.py
===================================================================
--- lldb/test/API/lang/c/modules/TestCModules.py
+++ lldb/test/API/lang/c/modules/TestCModules.py
@@ -14,9 +14,8 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipIfFreeBSD
     @expectedFailureAll(
-        oslist=["linux"],
+        oslist=["freebsd", "linux"],
         bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")
     @expectedFailureAll(
         oslist=["windows"],
Index: lldb/test/API/functionalities/thread/state/TestThreadStates.py
===================================================================
--- lldb/test/API/functionalities/thread/state/TestThreadStates.py
+++ lldb/test/API/functionalities/thread/state/TestThreadStates.py
@@ -32,7 +32,6 @@
     @expectedFailureAll(
         oslist=lldbplatformutil.getDarwinOSTriples(),
         bugnumber="llvm.org/pr23669")
-    @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr15824")
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
     def test_state_after_continue(self):
         """Test thread state after continue."""
Index: lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
===================================================================
--- lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
+++ lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
@@ -14,7 +14,6 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
     @skipIfWindows # This is flakey on Windows: llvm.org/pr38373
     def test(self):
         """Test thread exit during step handling."""
@@ -24,7 +23,6 @@
             'stop reason = instruction step',
             True)
 
-    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
     @skipIfWindows # This is flakey on Windows: llvm.org/pr38373
     def test_step_over(self):
         """Test thread exit during step-over handling."""
@@ -34,7 +32,6 @@
             'stop reason = step over',
             False)
 
-    @skipIfFreeBSD  # llvm.org/pr21411: test is hanging
     @skipIfWindows # This is flakey on Windows: llvm.org/pr38373
     def test_step_in(self):
         """Test thread exit during step-in handling."""
Index: lldb/test/API/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
===================================================================
--- lldb/test/API/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
+++ lldb/test/API/functionalities/thread/create_after_attach/TestCreateAfterAttach.py
@@ -22,13 +22,12 @@
         self.break_2 = line_number('main.cpp', '// Set second breakpoint here')
         self.break_3 = line_number('main.cpp', '// Set third breakpoint here')
 
-    @skipIfFreeBSD  # Hangs.  May be the same as Linux issue llvm.org/pr16229 but
     # not yet investigated.  Revisit once required functionality
     # is implemented for FreeBSD.
     # Occasionally hangs on Windows, may be same as other issues.
     @skipIfWindows
     @skipIfiOSSimulator
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     def test_create_after_attach(self):
         """Test thread creation after process attach."""
         self.build(dictionary=self.getBuildFlags(use_cpp11=False))
Index: lldb/test/API/functionalities/signal/raise/TestRaise.py
===================================================================
--- lldb/test/API/functionalities/signal/raise/TestRaise.py
+++ lldb/test/API/functionalities/signal/raise/TestRaise.py
@@ -24,12 +24,14 @@
         # scenario: https://llvm.org/bugs/show_bug.cgi?id=23574
 
     @skipIfDarwin  # darwin does not support real time signals
+    @skipIfFreeBSD  # hangs
     @skipIfTargetAndroid()
     def test_sigsigrtmin(self):
         self.build()
         self.signal_test('SIGRTMIN', True)
 
     @skipIfNetBSD  # Hangs on NetBSD
+    @skipIfFreeBSD  # hangs
     def test_sigtrap(self):
         self.build()
         self.signal_test('SIGTRAP', True)
Index: lldb/test/API/functionalities/signal/TestSendSignal.py
===================================================================
--- lldb/test/API/functionalities/signal/TestSendSignal.py
+++ lldb/test/API/functionalities/signal/TestSendSignal.py
@@ -18,9 +18,6 @@
         # Find the line number to break inside main().
         self.line = line_number('main.c', 'Put breakpoint here')
 
-    @expectedFailureAll(
-        oslist=['freebsd'],
-        bugnumber="llvm.org/pr23318: does not report running state")
     @expectedFailureNetBSD(bugnumber='llvm.org/pr43959')
     @skipIfWindows  # Windows does not support signals
     @skipIfReproducer # FIXME: Unexpected packet during (active) replay
Index: lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
===================================================================
--- lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
+++ lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
@@ -19,6 +19,7 @@
     NO_DEBUG_INFO_TESTCASE = True
 
     @skipIfWindows
+    @skipIfFreeBSD  # hangs
     def test_python_os_plugin(self):
         """Test that stepping works when the OS Plugin doesn't report all
            threads at every stop"""
@@ -27,6 +28,7 @@
         self.run_python_os_step_missing_thread(False)
 
     @skipIfWindows
+    @skipIfFreeBSD  # hangs
     def test_python_os_plugin_prune(self):
         """Test that pruning the unreported PlanStacks works"""
         self.build()
Index: lldb/test/API/functionalities/longjmp/TestLongjmp.py
===================================================================
--- lldb/test/API/functionalities/longjmp/TestLongjmp.py
+++ lldb/test/API/functionalities/longjmp/TestLongjmp.py
@@ -15,8 +15,7 @@
     mydir = TestBase.compute_mydir(__file__)
 
     @skipIfDarwin  # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
-    @skipIfFreeBSD  # llvm.org/pr17214
-    @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
+    @expectedFailureAll(oslist=["freebsd", "linux"], bugnumber="llvm.org/pr20231")
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
     @expectedFlakeyNetBSD
     def test_step_out(self):
@@ -25,8 +24,7 @@
         self.step_out()
 
     @skipIfDarwin  # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
-    @skipIfFreeBSD  # llvm.org/pr17214
-    @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
+    @expectedFailureAll(oslist=["freebsd", "linux"], bugnumber="llvm.org/pr20231")
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
     @skipIfNetBSD
     def test_step_over(self):
@@ -35,8 +33,7 @@
         self.step_over()
 
     @skipIfDarwin  # llvm.org/pr16769: LLDB on Mac OS X dies in function ReadRegisterBytes in GDBRemoteRegisterContext.cpp
-    @skipIfFreeBSD  # llvm.org/pr17214
-    @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr20231")
+    @expectedFailureAll(oslist=["freebsd", "linux"], bugnumber="llvm.org/pr20231")
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
     @expectedFlakeyNetBSD
     def test_step_back_out(self):
Index: lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
===================================================================
--- lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
+++ lldb/test/API/functionalities/load_using_paths/TestLoadUsingPaths.py
@@ -36,7 +36,6 @@
         self.hidden_dir = os.path.join(self.wd, 'hidden')
         self.hidden_lib = os.path.join(self.hidden_dir, self.lib_name)
 
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @not_remote_testsuite_ready
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
     @expectedFlakeyNetBSD
Index: lldb/test/API/functionalities/load_unload/TestLoadUnload.py
===================================================================
--- lldb/test/API/functionalities/load_unload/TestLoadUnload.py
+++ lldb/test/API/functionalities/load_unload/TestLoadUnload.py
@@ -90,11 +90,9 @@
 
     # libloadunload_d.so does not appear in the image list because executable
     # dependencies are resolved relative to the debuggers PWD. Bug?
-    @expectedFailureAll(oslist=["linux"])
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+    @expectedFailureAll(oslist=["freebsd", "linux", "netbsd"])
     @not_remote_testsuite_ready
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
-    @expectedFailureNetBSD
     @skipIfReproducer # VFS is a snapshot.
     def test_modules_search_paths(self):
         """Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'."""
@@ -147,12 +145,10 @@
 
     # libloadunload_d.so does not appear in the image list because executable
     # dependencies are resolved relative to the debuggers PWD. Bug?
-    @expectedFailureAll(oslist=["linux"])
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
+    @expectedFailureAll(oslist=["freebsd", "linux", "netbsd"])
     @expectedFailureAndroid  # wrong source file shows up for hidden library
     @skipIfWindows  # Windows doesn't have dlopen and friends, dynamic libraries work differently
     @skipIfDarwinEmbedded
-    @expectedFailureNetBSD
     def test_dyld_library_path(self):
         """Test (DY)LD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
         self.copy_shlibs_to_remote(hidden_dir=True)
@@ -207,7 +203,6 @@
         bugnumber="llvm.org/pr25805",
         hostoslist=["windows"],
         triple='.*-android')
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @expectedFailureAll(oslist=["windows"]) # process load not implemented
     def test_lldb_process_load_and_unload_commands(self):
         self.setSvr4Support(False)
@@ -217,7 +212,6 @@
         bugnumber="llvm.org/pr25805",
         hostoslist=["windows"],
         triple='.*-android')
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @expectedFailureAll(oslist=["windows"]) # process load not implemented
     def test_lldb_process_load_and_unload_commands_with_svr4(self):
         self.setSvr4Support(True)
@@ -294,13 +288,11 @@
 
         self.runCmd("process continue")
 
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @expectedFailureAll(oslist=["windows"]) # breakpoint not hit
     def test_load_unload(self):
         self.setSvr4Support(False)
         self.run_load_unload()
 
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     @expectedFailureAll(oslist=["windows"]) # breakpoint not hit
     def test_load_unload_with_svr4(self):
         self.setSvr4Support(True)
@@ -344,12 +336,10 @@
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
                     substrs=[' resolved, hit count = 2'])
 
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     def test_step_over_load(self):
         self.setSvr4Support(False)
         self.run_step_over_load()
 
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
     def test_step_over_load_with_svr4(self):
         self.setSvr4Support(True)
         self.run_step_over_load()
@@ -383,9 +373,7 @@
 
     # We can't find a breakpoint location for d_init before launching because
     # executable dependencies are resolved relative to the debuggers PWD. Bug?
-    @expectedFailureAll(oslist=["linux"], triple=no_match('aarch64-.*-android'))
-    @skipIfFreeBSD  # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "linux", "netbsd"], triple=no_match('aarch64-.*-android'))
     def test_static_init_during_load(self):
         """Test that we can set breakpoints correctly in static initializers"""
         self.copy_shlibs_to_remote()
Index: lldb/test/API/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferiorStep.py
===================================================================
--- lldb/test/API/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferiorStep.py
+++ lldb/test/API/functionalities/inferior-crashing/recursive-inferior/TestRecursiveInferiorStep.py
@@ -28,8 +28,7 @@
     # Inferior exits after stepping after a segfault. This is working as
     # intended IMHO.
     @skipIfLinux
-    @skipIfFreeBSD
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     def test_recursive_inferior_crashing_expr_step_and_expr(self):
         """Test that lldb expressions work before and after stepping after a crash."""
         self.build()
Index: lldb/test/API/functionalities/inferior-crashing/TestInferiorCrashingStep.py
===================================================================
--- lldb/test/API/functionalities/inferior-crashing/TestInferiorCrashingStep.py
+++ lldb/test/API/functionalities/inferior-crashing/TestInferiorCrashingStep.py
@@ -52,8 +52,7 @@
     # Inferior exits after stepping after a segfault. This is working as
     # intended IMHO.
     @skipIfLinux
-    @skipIfFreeBSD
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     def test_inferior_crashing_expr_step_and_expr(self):
         """Test that lldb expressions work before and after stepping after a crash."""
         self.build()
Index: lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestProcessConnect.py
@@ -36,6 +36,7 @@
             self.dbg.GetSelectedPlatform().DisconnectRemote()
 
     @skipIfWindows
+    @expectedFailureAll(oslist=["freebsd"])
     def test_process_connect_sync(self):
         """Test the gdb-remote command in synchronous mode"""
         try:
@@ -47,6 +48,7 @@
             self.dbg.GetSelectedPlatform().DisconnectRemote()
 
     @skipIfWindows
+    @expectedFailureAll(oslist=["freebsd"])
     @skipIfReproducer # Reproducer don't support async.
     def test_process_connect_async(self):
         """Test the gdb-remote command in asynchronous mode"""
Index: lldb/test/API/functionalities/exec/TestExec.py
===================================================================
--- lldb/test/API/functionalities/exec/TestExec.py
+++ lldb/test/API/functionalities/exec/TestExec.py
@@ -20,6 +20,7 @@
     @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
     @expectedFailureNetBSD
     @skipIfAsan # rdar://problem/43756823
+    @skipIfFreeBSD  # hangs
     @skipIfWindows
     def test_hitting_exec (self):
         self.do_test(False)
@@ -28,6 +29,7 @@
     @expectedFailureAll(oslist=["ios", "tvos", "watchos", "bridgeos"], bugnumber="rdar://problem/34559552") # this exec test has problems on ios systems
     @expectedFailureNetBSD
     @skipIfAsan # rdar://problem/43756823
+    @skipIfFreeBSD  # hangs
     @skipIfWindows
     def test_skipping_exec (self):
         self.do_test(True)
Index: lldb/test/API/functionalities/deleted-executable/TestDeletedExecutable.py
===================================================================
--- lldb/test/API/functionalities/deleted-executable/TestDeletedExecutable.py
+++ lldb/test/API/functionalities/deleted-executable/TestDeletedExecutable.py
@@ -16,10 +16,9 @@
     NO_DEBUG_INFO_TESTCASE = True
 
     @skipIfWindows # cannot delete a running executable
-    @expectedFailureAll(oslist=["linux"],
+    @expectedFailureAll(oslist=["freebsd", "linux", "netbsd"],
         triple=no_match('aarch64-.*-android'))
         # determining the architecture of the process fails
-    @expectedFailureNetBSD
     @skipIfReproducer # File synchronization is not supported during replay.
     def test(self):
         self.build()
Index: lldb/test/API/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
+++ lldb/test/API/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
@@ -20,7 +20,6 @@
         # Find the line number to break at.
         self.line = line_number('main.cpp', ' // Set breakpoint here.')
 
-    @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
     def test_with_run_command(self):
         """Test using Python synthetic children provider."""
         self.build()
Index: lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py
@@ -21,7 +21,6 @@
         # Find the line number to break at.
         self.line = line_number('main.cpp', 'break here')
 
-    @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
     def test_with_run_command(self):
         """Test using Python synthetic children provider to provide a value."""
         self.build()
Index: lldb/test/API/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-synthtype/TestDataFormatterSynthType.py
@@ -20,7 +20,6 @@
         # Find the line number to break at.
         self.line = line_number('main.cpp', 'break here')
 
-    @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
     def test_with_run_command(self):
         """Test using Python synthetic children provider to provide a typename."""
         self.build()
Index: lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
===================================================================
--- lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
@@ -15,7 +15,6 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @skipIfFreeBSD  # llvm.org/pr20545 bogus output confuses buildbot parser
     def test_with_run_command(self):
         """Test data formatter commands."""
         self.build()
Index: lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
===================================================================
--- lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
+++ lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -10,21 +10,12 @@
 from lldbsuite.test.decorators import *
 
 
-def python_leaky_fd_version(test):
-    import sys
-    # Python random module leaks file descriptors on some versions.
-    if sys.version_info >= (2, 7, 8) and sys.version_info < (2, 7, 10):
-        return "Python random module leaks file descriptors in this python version"
-    return None
-
-
 class AvoidsFdLeakTestCase(TestBase):
 
     NO_DEBUG_INFO_TESTCASE = True
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
     # The check for descriptor leakage needs to be implemented differently
     # here.
     @skipIfWindows
@@ -33,10 +24,6 @@
     def test_fd_leak_basic(self):
         self.do_test([])
 
-    @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
-    @expectedFailureAll(
-        oslist=['freebsd'],
-        bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
     # The check for descriptor leakage needs to be implemented differently
     # here.
     @skipIfWindows
@@ -65,10 +52,6 @@
             process.GetExitStatus() == 0,
             "Process returned non-zero status. Were incorrect file descriptors passed?")
 
-    @expectedFailureIfFn(python_leaky_fd_version, "bugs.freebsd.org/197376")
-    @expectedFailureAll(
-        oslist=['freebsd'],
-        bugnumber="llvm.org/pr25624 still failing with Python 2.7.10")
     # The check for descriptor leakage needs to be implemented differently
     # here.
     @skipIfWindows
Index: lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
===================================================================
--- lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
+++ lldb/test/API/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
@@ -22,6 +22,7 @@
         """Test that we can hit a watchpoint we set before starting another thread"""
         self.do_watchpoint_test("Before running the thread")
 
+    @expectedFailureAll(oslist=["freebsd"])
     def test_watchpoint_after_thread_start(self):
         """Test that we can hit a watchpoint we set after starting another thread"""
         self.do_watchpoint_test("After running the thread")
Index: lldb/test/API/commands/register/register/register_command/TestRegisters.py
===================================================================
--- lldb/test/API/commands/register/register/register_command/TestRegisters.py
+++ lldb/test/API/commands/register/register/register_command/TestRegisters.py
@@ -28,7 +28,7 @@
 
     @skipIfiOSSimulator
     @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
-    @expectedFailureNetBSD
+    @expectedFailureAll(oslist=["freebsd", "netbsd"])
     def test_register_commands(self):
         """Test commands related to registers, in particular vector registers."""
         self.build()
@@ -67,7 +67,6 @@
     @skipIfiOSSimulator
     # "register read fstat" always return 0xffff
     @expectedFailureAndroid(archs=["i386"])
-    @skipIfFreeBSD  # llvm.org/pr25057
     @skipIf(archs=no_match(['amd64', 'i386', 'x86_64']))
     @skipIfOutOfTreeDebugserver
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995")
Index: lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
===================================================================
--- lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
+++ lldb/test/API/commands/expression/no-deadlock/TestExprDoesntBlock.py
@@ -15,7 +15,6 @@
 
     mydir = TestBase.compute_mydir(__file__)
 
-    @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17946')
     @add_test_categories(["basic_process"])
     @skipIfReproducer # Timeouts are not currently modeled.
     def test_with_run_command(self):
Index: lldb/test/API/commands/expression/formatters/TestFormatters.py
===================================================================
--- lldb/test/API/commands/expression/formatters/TestFormatters.py
+++ lldb/test/API/commands/expression/formatters/TestFormatters.py
@@ -21,10 +21,6 @@
         self.line = line_number('main.cpp',
                                 '// Stop here')
 
-    @skipIfFreeBSD  # llvm.org/pr24691 skipping to avoid crashing the test runner
-    @expectedFailureAll(
-        oslist=['freebsd'],
-        bugnumber='llvm.org/pr19011 Newer Clang omits C1 complete object constructor')
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
     @skipIfTargetAndroid()  # skipping to avoid crashing the test runner
     @expectedFailureAndroid('llvm.org/pr24691')  # we hit an assertion in clang
Index: lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
===================================================================
--- lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
+++ lldb/test/API/commands/expression/call-restarts/TestCallThatRestarts.py
@@ -22,7 +22,6 @@
         self.main_source = "lotta-signals.c"
         self.main_source_spec = lldb.SBFileSpec(self.main_source)
 
-    @skipIfFreeBSD  # llvm.org/pr19246: intermittent failure
     @skipIfDarwin  # llvm.org/pr19246: intermittent failure
     @skipIfWindows  # Test relies on signals, unsupported on Windows
     @expectedFlakeyAndroid(bugnumber="llvm.org/pr19246")
Index: lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
===================================================================
--- lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
+++ lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py
@@ -19,7 +19,6 @@
 
     @skipIfNoSBHeaders
     @skipIfWindows
-    @expectedFailureAll(oslist=['freebsd'])
     def test_multiple_debuggers(self):
         env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
 
Index: lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+++ lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -79,14 +79,12 @@
 }
 
 void ProcessFreeBSD::Initialize() {
-  if (!getenv("FREEBSD_REMOTE_PLUGIN")) {
-    static llvm::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-    llvm::call_once(g_once_flag, []() {
-      PluginManager::RegisterPlugin(GetPluginNameStatic(),
-                                    GetPluginDescriptionStatic(), CreateInstance);
-    });
-  }
+  llvm::call_once(g_once_flag, []() {
+    PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                  GetPluginDescriptionStatic(), CreateInstance);
+  });
 }
 
 lldb_private::ConstString ProcessFreeBSD::GetPluginNameStatic() {
Index: lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -27,6 +27,9 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "llvm/ADT/Triple.h"
+#include "llvm/Support/Host.h"
+
 // Define these constants from FreeBSD mman.h for use when targeting remote
 // FreeBSD systems even when host has different values.
 #define MAP_PRIVATE 0x0002
@@ -245,15 +248,27 @@
 }
 
 bool PlatformFreeBSD::CanDebugProcess() {
-  if (getenv("FREEBSD_REMOTE_PLUGIN")) {
-    if (IsHost()) {
-      return true;
-    } else {
-      // If we're connected, we can debug.
-      return IsConnected();
-    }
+  llvm::Triple host_triple{llvm::sys::getProcessTriple()};
+  bool use_legacy_plugin;
+
+  switch (host_triple.getArch()) {
+    case llvm::Triple::x86:
+    case llvm::Triple::x86_64:
+      // FreeBSDRemote plugin supports x86 only at the moment
+      use_legacy_plugin = !!getenv("FREEBSD_LEGACY_PLUGIN");
+      break;
+    default:
+      use_legacy_plugin = true;
+  }
+
+  if (use_legacy_plugin)
+    return false;
+  else if (IsHost())
+    return true;
+  else {
+    // If we're connected, we can debug.
+    return IsConnected();
   }
-  return false;
 }
 
 void PlatformFreeBSD::CalculateTrapHandlerSymbolNames() {
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -952,8 +952,9 @@
             "netbsd" in target_platform or
             "windows" in target_platform)
 
-    # Don't do lldb-server (llgs) tests on anything except Linux and Windows.
+    # Don't do lldb-server (llgs) tests on platforms not supporting it.
     configuration.dont_do_llgs_test = not (
+            "freebsd" in target_platform or
             "linux" in target_platform or
             "netbsd" in target_platform or
             "windows" in target_platform)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to