[Lldb-commits] [lldb] [lldb][AIX] Adding NativeThreadAIX (PR #139537)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed May 14 02:48:02 PDT 2025


================
@@ -0,0 +1,71 @@
+//===-- NativeThreadAIX.cpp ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "NativeThreadAIX.h"
+#include "NativeProcessAIX.h"
+#include "lldb/Utility/State.h"
+#include <procinfo.h>
+#include <sys/procfs.h>
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::process_aix;
+
+NativeThreadAIX::NativeThreadAIX(NativeProcessAIX &process, lldb::tid_t tid)
+    : NativeThreadProtocol(process, tid), m_state(StateType::eStateInvalid) {}
+
+std::string NativeThreadAIX::GetName() {
+  NativeProcessAIX &process = GetProcess();
+  auto BufferOrError = getProcFile(process.GetID(), "psinfo");
+  if (!BufferOrError)
+    return "";
+  auto &Buffer = *BufferOrError;
+  if (Buffer->getBufferSize() < sizeof(psinfo_t))
+    return "";
+  const psinfo_t *psinfo =
+      reinterpret_cast<const psinfo_t *>(Buffer->getBufferStart());
+  return std::string(psinfo->pr_fname);
+}
----------------
labath wrote:

You also shouldn't expect that the "process stopped" output will contain the name of the process. That really is the name of the thread -- it just happens that on linux the main thread gets the name of the process. On macos for instance, this output doesn't contain the name of the process, even for the main thread:
```
(lldb) Process 6668 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000185cf1b6c libsystem_kernel.dylib`__read_nocancel + 8
```

https://github.com/llvm/llvm-project/pull/139537


More information about the lldb-commits mailing list