[Lldb-commits] [lldb] [lldb] Add MSVC STL/libstdc++ formatters for error_code and error_condition (PR #217245)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 20 05:29:49 PDT 2026
================
@@ -0,0 +1,41 @@
+"""Test std::error_code / std::error_condition summaries."""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class StdErrorCodeTestCase(TestBase):
+ SHARED_BUILD_TESTCASE = False
+ TEST_WITH_PDB_DEBUG_INFO = True
+
+ def check_value(self, name, summary):
+ value = self.frame().FindVariable(name)
+ self.assertSuccess(value.GetError())
+ self.assertEqual(value.summary, summary)
+ self.assertEqual(value.GetNumChildren(), 1)
+
+ category = value.GetChildMemberWithName("Category")
+ self.assertTrue(category.IsValid())
+ self.assertNotEqual(category.GetValueAsUnsigned(), 0)
+
+ def do_test(self):
+ lldbutil.run_to_source_breakpoint(
+ self, "// break here", lldb.SBFileSpec("main.cpp")
+ )
+
+ self.check_value("ec", "value=2")
----------------
Nerixyz wrote:
You can use `self.expect_var_path` (similar to `expect_expr`) here along with `ValueCheck`:
https://github.com/llvm/llvm-project/blob/2526c9db1be9762d70d1fb55217cfc96165bc315/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py#L34-L47
https://github.com/llvm/llvm-project/pull/217245
More information about the lldb-commits
mailing list