Skip to content

[lldb] Fix TestSBValueSetTypeSyntheticOverride with libstdc++#210495

Merged
Nerixyz merged 3 commits into
llvm:mainfrom
mentlerd:fix_set_sbtype_test
Jul 18, 2026
Merged

[lldb] Fix TestSBValueSetTypeSyntheticOverride with libstdc++#210495
Nerixyz merged 3 commits into
llvm:mainfrom
mentlerd:fix_set_sbtype_test

Conversation

@mentlerd

@mentlerd mentlerd commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

My test added in #209056 assumed that a CXXSyntheticChildren implementation for std::vector is readily available on all platforms, that is not the case.

Do the simplest thing and remove this part of the test for now.

Fixes: https://lab.llvm.org/buildbot/#/builders/59/builds/35839

FAIL: test (TestSBValueSetTypeSyntheticOverride.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py", line 22, in test
    self.checkOverride(vec, before=None)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py", line 43, in checkOverride
    self.assertIsNone(impl_before)
AssertionError: <lldb.formatters.cpp.gnu_libstdcpp.StdVectorSynthProvider object at 0xfb088f787bb0> is not None

This is not necessarily true across all configurations, particularly
with gnu libstdc++
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-lldb

Author: David Mentler (mentlerd)

Changes

My test added in #209056 assumed that a CXXSyntheticChildren implementation for std::vector is readily available on all platforms, that is not the case.

Do the safe thing and skip that part of the test if conditions are not right.


Full diff: https://github.com/llvm/llvm-project/pull/210495.diff

1 Files Affected:

  • (modified) lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py (+5-2)
diff --git a/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py b/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py
index e5e8f29ba0e75..907d1af956219 100644
--- a/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py
+++ b/lldb/test/API/python_api/sbvalue_set_type_synthetic_override/TestSBValueSetTypeSyntheticOverride.py
@@ -18,8 +18,11 @@ def test(self):
 
         # CXX runtime synthetic can be overridden
         vec = frame.FindVariable("vec")
-        self.assertTrue(vec.IsSynthetic())
-        self.checkOverride(vec, before=None)
+
+        # GNU libstdc++'s std::vector doesn't have a CXXSyntheticChildren implementation
+        # Use the fact that GetTypeSynthetic() only returns scripted SCPs to filter
+        if vec.IsSynthetic() and vec.GetTypeSynthetic() is None:
+            self.checkOverride(vec, before=None)
 
         # Python synthetic can be overridden
         foo = frame.FindVariable("foo")

@mentlerd
mentlerd marked this pull request as draft July 18, 2026 08:26
This part of the test has a non-trivial expectation against the LLDB which it
tests: it wants std::vector to have a non-scripted synthetic child provider
implementation.
@mentlerd

Copy link
Copy Markdown
Contributor Author

My rationale for the removal is that it's best if the test only relies on the part of the environment it controls. The builtin formatter case is still interesting, but there isn't a reliable way of telling if an SCP implementation is builtin or not at the moment. (SBTypeSynthetic only represents scripted SCPs at the moment)

@mentlerd
mentlerd marked this pull request as ready for review July 18, 2026 08:37
@Nerixyz

Nerixyz commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

My test added in #209056 assumed that a CXXSyntheticChildren implementation for std::vector is readily available on all platforms, that is not the case.

I'm not sure if I understand this correctly. You were checking that there wasn't a synthetic children provider: self.checkOverride(vec, before=None). But in you're description, you said that you expected a provider.

@mentlerd

mentlerd commented Jul 18, 2026

Copy link
Copy Markdown
Contributor Author

I'm not sure if I understand this correctly. You were checking that there wasn't a synthetic children provider: self.checkOverride(vec, before=None). But in you're description, you said that you expected a provider.

I was checking that the scripted synthetic child provider's python implementation is None with the new API SBValue::GetTypeSyntheticImplementation(). That is to be expected if the SCP is implemented in C++, but for libstdc++ that is not the case, there is a Python implementation instead of native code compiled into LLDB.

The now removed test wished to check if a CXXSyntheticChildren based SCP was compatible with SBValue::SetTypeSynthetic()s (another new API) ability to influence the SCP choice.

@Nerixyz

Nerixyz commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Can you ignore the before check for vec but keep the check that you can override the synthetic children provider? So that we check it for libc++ and the MSVC STL.

@mentlerd

Copy link
Copy Markdown
Contributor Author

Sure, that makes sense. Done!

@Nerixyz
Nerixyz merged commit d46a352 into llvm:main Jul 18, 2026
13 checks passed
@mentlerd
mentlerd deleted the fix_set_sbtype_test branch July 18, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants