https://github.com/Nerixyz created 
https://github.com/llvm/llvm-project/pull/172349

Because PDB doesn't know about templates, we need to get to `T` of 
`std::atomic<T>` differently. The type includes the `value_type` typedef, which 
is always equal to `T`. The native PDB plugin includes this since #169248.

Then we can run the `std::atomic` test with (native) PDB.

>From 24308edf9c135403acef5d28aea9172dc21eabbd Mon Sep 17 00:00:00 2001
From: Nerixyz <[email protected]>
Date: Thu, 6 Nov 2025 21:00:28 +0100
Subject: [PATCH] [LLDB] Run MSVC STL atomic tests with PDB

---
 .../Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp    | 13 +++++++++++--
 .../generic/atomic/TestDataFormatterStdAtomic.py    |  2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
index 020ba10166231..0e5464448c686 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
@@ -64,10 +64,19 @@ 
lldb_private::formatters::MsvcStlAtomicSyntheticFrontEnd::Update() {
   if (!storage_sp)
     return lldb::ChildCacheState::eRefetch;
 
-  m_element_type = m_backend.GetCompilerType().GetTypeTemplateArgument(0);
-  if (!m_element_type)
+  CompilerType backend_type = m_backend.GetCompilerType();
+  if (!backend_type)
     return lldb::ChildCacheState::eRefetch;
 
+  m_element_type = backend_type.GetTypeTemplateArgument(0);
+  if (!m_element_type) {
+    // PDB doesn't have info about templates, so use value_type which equals T.
+    m_element_type = backend_type.GetDirectNestedTypeWithName("value_type");
+
+    if (!m_element_type)
+      return lldb::ChildCacheState::eRefetch;
+  }
+
   m_storage = storage_sp.get();
   return lldb::ChildCacheState::eRefetch;
 }
diff --git 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py
 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py
index bdf12ca3b86db..67c2c359c9afb 100644
--- 
a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py
+++ 
b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py
@@ -10,6 +10,8 @@
 
 
 class StdAtomicTestCase(TestBase):
+    TEST_WITH_PDB_DEBUG_INFO = True
+
     def get_variable(self, name):
         var = self.frame().FindVariable(name)
         var.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)

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

Reply via email to