[Lldb-commits] [lldb] lldb: add support for thread names on Windows (PR #74731)

via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 7 11:59:12 PST 2023


================
@@ -175,3 +179,30 @@ Status TargetThreadWindows::DoResume() {
 
   return Status();
 }
+
+const char *TargetThreadWindows::GetName() {
+  Log *log = GetLog(LLDBLog::Thread);
+  HMODULE hModule = ::LoadLibraryW(L"Kernel32.dll");
+  if (hModule) {
+    auto GetThreadDescription =
+        reinterpret_cast<GetThreadDescriptionFunctionPtr>(
+            ::GetProcAddress(hModule, "GetThreadDescription"));
----------------
Fulgen301 wrote:

The function was added in Windows 10 1607, which was also the only build (excluding Server 2016) where it isn't available in the header:

> [Windows Server 2016, Windows 10 LTSB 2016 and Windows 10 version 1607: GetThreadDescription is only available by Run Time Dynamic Linking in KernelBase.dll.](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription)

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


More information about the lldb-commits mailing list