From 1c7c9970379e1949a0b338eba2746dbf84b0bda4 Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Tue, 27 Jun 2023 10:57:27 -0700 Subject: [PATCH] [lldb] Deprecate SBHostOS threading functionality For some context, Raphael tried to this before: https://reviews.llvm.org/D104231 These methods are not tested at all, and in some cases, are not even fully implemented (e.g. SBHostOS::ThreadCreated). I'm not convinced it's possible to use these correctly from Python, and I'm not aware of any users of these methods. It's difficult to remove these methods wholesale, but we can start with deprecating them. A possible follow-up to this change (which may require an RFC to get more buy in from the community) is to gut these functions entirely. That is, remove the implementations and replace them either with nothing or have them dump out a message to stderr saying not to use these. Differential Revision: https://reviews.llvm.org/D153900 --- lldb/include/lldb/API/SBHostOS.h | 11 +++++++++++ lldb/tools/driver/Driver.cpp | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lldb/include/lldb/API/SBHostOS.h b/lldb/include/lldb/API/SBHostOS.h index b170f8d..ad57a9ec 100644 --- a/lldb/include/lldb/API/SBHostOS.h +++ b/lldb/include/lldb/API/SBHostOS.h @@ -24,15 +24,26 @@ public: static lldb::SBFileSpec GetUserHomeDirectory(); + LLDB_DEPRECATED("Threading functionality in SBHostOS is not well supported, " + "not portable, and is difficult to use from Python.") static void ThreadCreated(const char *name); + LLDB_DEPRECATED("Threading functionality in SBHostOS is not well supported, " + "not portable, and is difficult to use from Python.") static lldb::thread_t ThreadCreate(const char *name, lldb::thread_func_t thread_function, void *thread_arg, lldb::SBError *err); + LLDB_DEPRECATED("Threading functionality in SBHostOS is not well supported, " + "not portable, and is difficult to use from Python.") static bool ThreadCancel(lldb::thread_t thread, lldb::SBError *err); + LLDB_DEPRECATED("Threading functionality in SBHostOS is not well supported, " + "not portable, and is difficult to use from Python.") static bool ThreadDetach(lldb::thread_t thread, lldb::SBError *err); + + LLDB_DEPRECATED("Threading functionality in SBHostOS is not well supported, " + "not portable, and is difficult to use from Python.") static bool ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result, lldb::SBError *err); diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index d463267..b14d156 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -795,8 +795,6 @@ int main(int argc, char const *argv[]) { // Setup LLDB signal handlers once the debugger has been initialized. SBDebugger::PrintDiagnosticsOnError(); - SBHostOS::ThreadCreated(""); - signal(SIGINT, sigint_handler); #if !defined(_WIN32) signal(SIGPIPE, SIG_IGN); -- 2.7.4