llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: nerix (Nerixyz)

<details>
<summary>Changes</summary>

Because PDB doesn't know about templates, we need to get to `T` of 
`std::atomic&lt;T&gt;` 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.

---
Full diff: https://github.com/llvm/llvm-project/pull/172349.diff


2 Files Affected:

- (modified) lldb/source/Plugins/Language/CPlusPlus/MsvcStlAtomic.cpp (+11-2) 
- (modified) 
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/atomic/TestDataFormatterStdAtomic.py
 (+2) 


``````````diff
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)

``````````

</details>


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

Reply via email to