[Lldb-commits] [lldb] [lldb] Support custom LLVM formatting for variables (PR #81196)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 21 14:52:19 PDT 2024


================
@@ -0,0 +1,18 @@
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class TestCase(TestBase):
+
+    def test_raw_bytes(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
+        self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' Bytes")
+        self.expect("v bytes", substrs=[" = 3001!"])
+
+    def test_bad_format(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
+        self.runCmd("type summary add -s '${var.ubyte:y}!' Bytes")
+        self.expect("v bytes", substrs=[" = '0'!"])
----------------
adrian-prantl wrote:

should there be an error message of sorts?

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


More information about the lldb-commits mailing list