Author: nerix
Date: 2025-12-16T18:26:27+01:00
New Revision: eaf6d9a2ff50b4fa9e4f59c59f102b95701735f5

URL: 
https://github.com/llvm/llvm-project/commit/eaf6d9a2ff50b4fa9e4f59c59f102b95701735f5
DIFF: 
https://github.com/llvm/llvm-project/commit/eaf6d9a2ff50b4fa9e4f59c59f102b95701735f5.diff

LOG: [LLDB] Run MSVC STL atomic tests with PDB (#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.

Added: 
    

Modified: 
    lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp
    
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py

Removed: 
    


################################################################################
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