[Lldb-commits] [lldb] [lldb] [disassembler] chore: enhance VariableAnnotator to return structured data (PR #165163)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 27 21:20:01 PDT 2025


================
@@ -116,3 +116,174 @@ def test_seed_reg_const_undef(self):
         print(out)
         self.assertRegex(out, r"\b(i|argc)\s*=\s*(DW_OP_reg\d+\b|R[A-Z0-9]+)")
         self.assertNotIn("<decoding error>", out)
+
+    @no_debug_info_test
+    @skipIf(archs=no_match(["x86_64"]))
+    def test_structured_annotations_api(self):
+        """Test GetVariableAnnotations() API returns structured data"""
+        obj = self._build_obj("d_original_example.o")
+        target = self._create_target(obj)
+
+        main_symbols = target.FindSymbols("main")
+        self.assertTrue(main_symbols.IsValid() and main_symbols.GetSize() > 0,
+                       "Could not find 'main' symbol")
+
+        main_symbol = main_symbols.GetContextAtIndex(0).GetSymbol()
+        start_addr = main_symbol.GetStartAddress()
+        self.assertTrue(start_addr.IsValid(), "Invalid start address for main")
+
+        instructions = target.ReadInstructions(start_addr, 16)
+        self.assertGreater(instructions.GetSize(), 0, "No instructions read")
+
+        print(f"\nTesting GetVariableAnnotations() API on {instructions.GetSize()} instructions")
----------------
JDevlieghere wrote:

Print statements are usually guarded by `if self.TraceOn():`

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


More information about the lldb-commits mailing list