[Lldb-commits] [lldb] r336991 - Add abbreviated name for Debugger::EventHandlerThread.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 13 10:36:42 PDT 2018


There's code in the ThreadHandler to handle systems with short thread names.  If that isn't producing readable names, we should fix it there.  A better algorithm might be to drop the leading "lldb" and then instead of truncating drop vowels (maybe leaving the first vowel after a .)  So you'd get "dbggr.evnt-hndlr" which isn't too bad.  Could drop duplicated consonants too.  It seems a shame for every caller to have to worry about this.

Jim


> On Jul 13, 2018, at 4:21 AM, Tatyana Krasnukha via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> Author: tkrasnukha
> Date: Fri Jul 13 04:21:06 2018
> New Revision: 336991
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=336991&view=rev
> Log:
> Add abbreviated name for Debugger::EventHandlerThread.
> 
> On OS's where thread names are limited to 16 bytes, the full name was truncated to not very meaningful "r.event-handler".
> 
> Modified:
>    lldb/trunk/source/Core/Debugger.cpp
> 
> Modified: lldb/trunk/source/Core/Debugger.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=336991&r1=336990&r2=336991&view=diff
> ==============================================================================
> --- lldb/trunk/source/Core/Debugger.cpp (original)
> +++ lldb/trunk/source/Core/Debugger.cpp Fri Jul 13 04:21:06 2018
> @@ -1586,15 +1586,18 @@ bool Debugger::StartEventHandlerThread()
>     // is up and running and listening to events before we return from this
>     // function. We do this by listening to events for the
>     // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster
> -    ListenerSP listener_sp(
> -        Listener::MakeListener("lldb.debugger.event-handler"));
> +    ConstString full_name("lldb.debugger.event-handler");
> +    ListenerSP listener_sp(Listener::MakeListener(full_name.AsCString()));
>     listener_sp->StartListeningForEvents(&m_sync_broadcaster,
>                                          eBroadcastBitEventThreadIsListening);
> 
> +    auto thread_name =
> +        full_name.GetLength() < llvm::get_max_thread_name_length() ?
> +        full_name.AsCString() : "dbg.evt-handler";
> +
>     // Use larger 8MB stack for this thread
> -    m_event_handler_thread = ThreadLauncher::LaunchThread(
> -        "lldb.debugger.event-handler", EventHandlerThread, this, nullptr,
> -        g_debugger_event_thread_stack_bytes);
> +    m_event_handler_thread = ThreadLauncher::LaunchThread(thread_name,
> +        EventHandlerThread, this, nullptr, g_debugger_event_thread_stack_bytes);
> 
>     // Make sure DefaultEventHandler() is running and listening to events
>     // before we return from this function. We are only listening for events of
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list