Author: Ebuka Ezike
Date: 2026-01-08T17:13:26Z
New Revision: cb6ee6cb49e4e6b4969f98ba9129b64094387279

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

LOG: [lldb-dap][NFC] Shorten the event thread name (#174837)

On linux thread names are limited to 15 characters, shorten the name of
the event thread if necessary

Added: 
    

Modified: 
    lldb/tools/lldb-dap/EventHelper.cpp
    lldb/tools/lldb-dap/tool/lldb-dap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/EventHelper.cpp 
b/lldb/tools/lldb-dap/EventHelper.cpp
index 01d4547e2d228..6c5a9127f131b 100644
--- a/lldb/tools/lldb-dap/EventHelper.cpp
+++ b/lldb/tools/lldb-dap/EventHelper.cpp
@@ -589,7 +589,12 @@ static void HandleDiagnosticEvent(const lldb::SBEvent 
&event, Log &log) {
 // is required.
 void EventThread(lldb::SBDebugger debugger, lldb::SBBroadcaster broadcaster,
                  llvm::StringRef client_name, Log &log) {
-  llvm::set_thread_name("lldb.DAP.client." + client_name + ".event_handler");
+  std::string thread_name =
+      llvm::formatv("lldb.DAP.client.{}.event_handler", client_name);
+  if (thread_name.length() > llvm::get_max_thread_name_length())
+    thread_name = llvm::formatv("DAP.{}.evt", client_name);
+  llvm::set_thread_name(thread_name);
+
   lldb::SBListener listener = debugger.GetListener();
   broadcaster.AddListener(listener, eBroadcastBitStopEventThread);
   debugger.GetBroadcaster().AddListener(

diff  --git a/lldb/tools/lldb-dap/tool/lldb-dap.cpp 
b/lldb/tools/lldb-dap/tool/lldb-dap.cpp
index e3b9d57e7d3a1..0119f4b1083a9 100644
--- a/lldb/tools/lldb-dap/tool/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/tool/lldb-dap.cpp
@@ -451,7 +451,7 @@ static llvm::Error serveConnection(
     if (connection_timeout_seconds)
       ResetConnectionTimeout(g_connection_timeout_mutex,
                              g_connection_timeout_time_point);
-    std::string client_name = llvm::formatv("client_{0}", clientCount++).str();
+    const std::string client_name = llvm::formatv("conn{0}", clientCount++);
     lldb::IOObjectSP io(std::move(sock));
 
     // Move the client into a background thread to unblock accepting the next


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to