[Lldb-commits] [lldb] [lldb][SymbolFileDWARF] Share GetDIEToType between SymbolFiles of a SymbolFileDWARFDebugMap (PR #120569)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 23 02:34:50 PST 2024
================
@@ -0,0 +1,40 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCaseTypedefToOuterFwd(TestBase):
+ """
+ We a global variable whose type is forward declared. We then
+ try to get the Ref typedef (whose definition is in either main.o
+ or lib.o). Make sure we correctly resolve this typedef.
+
+ We test this for two cases, where the definition lives
+ in main.o or lib.o.
+ """
+
+ def check_global_var(self, target, name: str):
+ var = target.FindFirstGlobalVariable(name)
+ self.assertSuccess(var.GetError(), f"Found {name}")
+
+ var_type = var.GetType()
+ self.assertTrue(var_type)
+
+ impl = var_type.GetPointeeType()
+ self.assertTrue(impl)
+
+ ref = impl.FindDirectNestedType("Ref")
+ self.assertTrue(ref)
+
+ self.assertEqual(ref.GetCanonicalType(), var_type)
+
+ def test_definition_in_main(self):
----------------
Michael137 wrote:
good point, done
https://github.com/llvm/llvm-project/pull/120569
More information about the lldb-commits
mailing list