[Lldb-commits] [lldb] [lldb] Fix TestSBValueSetTypeSyntheticOverride with libstdc++ (PR #210495)
David Mentler via lldb-commits
lldb-commits at lists.llvm.org
Sat Jul 18 03:32:50 PDT 2026
https://github.com/mentlerd updated https://github.com/llvm/llvm-project/pull/210495
>From bca867faafed4d2fd1fb83b27f75133a73fbb3d2 Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 18 Jul 2026 09:16:27 +0200
Subject: [PATCH 1/3] Fix bad assumption about std::vectors SCP being
implemented in C++
This is not necessarily true across all configurations, particularly
with gnu libstdc++
---
.../TestSBValueSetTypeSyntheticOverride.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
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")
>From 137af5dd7caca7885a0a1fe9040bfdf7d0c29310 Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 18 Jul 2026 10:32:03 +0200
Subject: [PATCH 2/3] Do the even simpler thing and omit testing against CXX
synths
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.
---
.../TestSBValueSetTypeSyntheticOverride.py | 8 --------
1 file changed, 8 deletions(-)
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 907d1af956219..8f8d3374218b3 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
@@ -16,14 +16,6 @@ def test(self):
frame = thread.GetFrameAtIndex(0)
- # CXX runtime synthetic can be overridden
- vec = frame.FindVariable("vec")
-
- # 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")
self.assertTrue(foo.IsSynthetic())
>From b450978e9cd3b396cbb7ab5ced815aad2bf4d70a Mon Sep 17 00:00:00 2001
From: mentlerd <mentlerd at gmail.com>
Date: Sat, 18 Jul 2026 12:31:22 +0200
Subject: [PATCH 3/3] Skip checking the before implementation for std::vector
---
.../TestSBValueSetTypeSyntheticOverride.py | 26 ++++++++++++++-----
1 file changed, 19 insertions(+), 7 deletions(-)
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 8f8d3374218b3..39f0243c63896 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
@@ -16,6 +16,17 @@ def test(self):
frame = thread.GetFrameAtIndex(0)
+ # CXX runtime synthetic can be overridden
+ vec = frame.FindVariable("vec")
+ self.assertTrue(vec.IsSynthetic())
+
+ # On some platforms the synthetic child provider implementation of
+ # std::vector is not native, in other words it's scripted
+ #
+ # This test can't reliably tell the difference, so skip checking
+ # the 'before' implementation typename check
+ self.checkOverride(vec, before=None, skip_before_impl_check=True)
+
# Python synthetic can be overridden
foo = frame.FindVariable("foo")
self.assertTrue(foo.IsSynthetic())
@@ -26,19 +37,20 @@ def test(self):
self.assertFalse(bar.IsSynthetic())
self.checkOverride(bar, before=None)
- def checkOverride(self, value, before):
+ def checkOverride(self, value, before, skip_before_impl_check=False):
foo = lldb.SBTypeSynthetic.CreateWithClassName(f"foo_bar_synths.FooSynthetic")
bar = lldb.SBTypeSynthetic.CreateWithClassName(f"foo_bar_synths.BarSynthetic")
# Target the static (non synthetic) ValueObject
static = value.GetNonSyntheticValue()
- impl_before = static.GetSyntheticValue().GetTypeSyntheticImplementation()
- if not before:
- self.assertIsNone(impl_before)
- else:
- self.assertIsNotNone(impl_before)
- self.assertEqual(type(impl_before).__name__, before)
+ if not skip_before_impl_check:
+ impl_before = static.GetSyntheticValue().GetTypeSyntheticImplementation()
+ if not before:
+ self.assertIsNone(impl_before)
+ else:
+ self.assertIsNotNone(impl_before)
+ self.assertEqual(type(impl_before).__name__, before)
static.SetTypeSynthetic(bar)
self.assertEqual(static.GetTypeSynthetic(), bar)
More information about the lldb-commits
mailing list