From 199d0a9d9225e560432301e39439296d57fa0e34 Mon Sep 17 00:00:00 2001 From: Oberd <112550174+oberdfr@users.noreply.github.com> Date: Tue, 6 Oct 2026 21:43:36 +0200 Subject: [PATCH] kernel: name guest threads on the host (#1106) PthreadCreate carries a guest thread name, but RunThread never handed it to the host, so every guest thread showed up as the same generic host thread name in core dumps, perf samples and htop. Call pthread_setname_np() on Linux so host-side diagnostics can attribute work to the guest thread that caused it. --- src/kernel/pthread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/kernel/pthread.cpp b/src/kernel/pthread.cpp index e4fbc624..21be846c 100644 --- a/src/kernel/pthread.cpp +++ b/src/kernel/pthread.cpp @@ -3200,6 +3200,11 @@ static void* RunThread(void* arg) { os_thread_id = GetHostThreadId(); #endif thread->host_thread_id = os_thread_id; +#if KYTY_PLATFORM == KYTY_PLATFORM_LINUX + if (!thread->name.empty()) { + pthread_setname_np(pthread_self(), thread->name.substr(0, 15).c_str()); + } +#endif LOGF("\tPthread run begin: %s, id = %d, os_thread_id = %" PRIu64 ", entry = 0x%016" PRIx64 ", arg = 0x%016" PRIx64 ", stack_addr = 0x%016" PRIx64 ", stack_size = %" PRIu64 "\n",