[Lldb-commits] [lldb] [lldb/API] Add setters to SBStructuredData (PR #154445)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 21 13:56:43 PDT 2025


================
@@ -130,6 +130,38 @@ class MyRandomClass:
         self.assertSuccess(example.SetFromJSON("null"))
         self.assertEqual(example.GetType(), lldb.eStructuredDataTypeNull)
 
+        example = lldb.SBStructuredData()
+        example.SetUnsignedIntegerValue(1)
+        self.assertEqual(example.GetType(), lldb.eStructuredDataTypeInteger)
+        self.assertEqual(example.GetIntegerValue(), 1)
+
+        example.SetSignedIntegerValue(-42)
+        self.assertEqual(example.GetType(), lldb.eStructuredDataTypeSignedInteger)
+        self.assertEqual(example.GetSignedIntegerValue(), -42)
+
+        example.SetFloatValue(4.19)
+        self.assertEqual(example.GetType(), lldb.eStructuredDataTypeFloat)
+        self.assertEqual(example.GetFloatValue(), 4.19)
+
+        example.SetStringValue("Bonjour, 123!")
+        self.assertEqual(example.GetType(), lldb.eStructuredDataTypeString)
+        self.assertEqual(example.GetStringValue(42), "Bonjour, 123!")
+
----------------
bulbazord wrote:

Can you add a test for dictionary, both adding to an existing one and clobbering a structured data of different type?

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


More information about the lldb-commits mailing list