[Lldb-commits] [lldb] 69fdbdc - [lldb] Remove support for SBHostOS threading functionality

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 14 14:34:58 PDT 2023


Author: Alex Langford
Date: 2023-08-14T14:33:08-07:00
New Revision: 69fdbdc4493aacf4d418a063930b39b02b5e18c5

URL: https://github.com/llvm/llvm-project/commit/69fdbdc4493aacf4d418a063930b39b02b5e18c5
DIFF: https://github.com/llvm/llvm-project/commit/69fdbdc4493aacf4d418a063930b39b02b5e18c5.diff

LOG: [lldb] Remove support for SBHostOS threading functionality

As stated on Discourse*, these methods have been deprecated. I am
removing their implementation. They will now do nothing and return a
value indicating failure (where appropriate).
Due to the LLDB project's commitment to ABI stability at the SB API
layer, we cannot remove these symbols completely.

Discourse link: https://discourse.llvm.org/t/do-you-use-the-threading-functionality-in-sbhostos/71973

Added: 
    

Modified: 
    lldb/source/API/SBHostOS.cpp
    llvm/docs/ReleaseNotes.rst

Removed: 
    


################################################################################
diff  --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp
index cb026fd9203b9b..a77a703bba37b5 100644
--- a/lldb/source/API/SBHostOS.cpp
+++ b/lldb/source/API/SBHostOS.cpp
@@ -101,61 +101,23 @@ lldb::thread_t SBHostOS::ThreadCreate(const char *name,
                                       lldb::thread_func_t thread_function,
                                       void *thread_arg, SBError *error_ptr) {
   LLDB_INSTRUMENT_VA(name, thread_function, thread_arg, error_ptr);
-  llvm::Expected<HostThread> thread =
-      ThreadLauncher::LaunchThread(name, [thread_function, thread_arg] {
-        return thread_function(thread_arg);
-      });
-  if (!thread) {
-    if (error_ptr)
-      error_ptr->SetError(Status(thread.takeError()));
-    else
-      llvm::consumeError(thread.takeError());
-    return LLDB_INVALID_HOST_THREAD;
-  }
-
-  return thread->Release();
+  return LLDB_INVALID_HOST_THREAD;
 }
 
 void SBHostOS::ThreadCreated(const char *name) { LLDB_INSTRUMENT_VA(name); }
 
 bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
   LLDB_INSTRUMENT_VA(thread, error_ptr);
-
-  Status error;
-  HostThread host_thread(thread);
-  error = host_thread.Cancel();
-  if (error_ptr)
-    error_ptr->SetError(error);
-  host_thread.Release();
-  return error.Success();
+  return false;
 }
 
 bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
   LLDB_INSTRUMENT_VA(thread, error_ptr);
-
-  Status error;
-#if defined(_WIN32)
-  if (error_ptr)
-    error_ptr->SetErrorString("ThreadDetach is not supported on this platform");
-#else
-  HostThread host_thread(thread);
-  error = host_thread.GetNativeThread().Detach();
-  if (error_ptr)
-    error_ptr->SetError(error);
-  host_thread.Release();
-#endif
-  return error.Success();
+  return false;
 }
 
 bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
                           SBError *error_ptr) {
   LLDB_INSTRUMENT_VA(thread, result, error_ptr);
-
-  Status error;
-  HostThread host_thread(thread);
-  error = host_thread.Join(result);
-  if (error_ptr)
-    error_ptr->SetError(error);
-  host_thread.Release();
-  return error.Success();
+  return false;
 }

diff  --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst
index 3d50c3f6fd8f95..4d0d531485051c 100644
--- a/llvm/docs/ReleaseNotes.rst
+++ b/llvm/docs/ReleaseNotes.rst
@@ -151,6 +151,9 @@ Changes to the LLVM tools
 Changes to LLDB
 ---------------------------------
 
+* Methods in SBHostOS related to threads have had their implementations
+  removed. These methods will return a value indicating failure.
+
 Changes to Sanitizers
 ---------------------
 * HWASan now defaults to detecting use-after-scope bugs.


        


More information about the lldb-commits mailing list