summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py28
-rw-r--r--lldb/test/API/python_api/sbvalue_synthetic/main.cpp9
2 files changed, 37 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py b/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py
index 2fd1e0ce9c6a..8b36308de63d 100644
--- a/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py
+++ b/lldb/test/API/python_api/sbvalue_synthetic/TestSBValueSynthetic.py
@@ -21,3 +21,31 @@ class TestSBValueSynthetic(TestBase):
has_formatted = self.frame().FindVariable("has_foo")
self.expect(str(formatted), exe=False, substrs=["synth_child"])
self.expect(str(has_formatted), exe=False, substrs=["synth_child"])
+
+ def test_synth_arr(self):
+ self.build()
+ lldbutil.run_to_source_breakpoint(
+ self, "break here", lldb.SBFileSpec("main.cpp")
+ )
+ point_arr = self.frame().FindVariable("point_arr")
+ point_ptr = self.frame().FindVariable("point_ptr")
+ for v in [point_arr, point_ptr]:
+ for i in range(3):
+ child = v.GetChildAtIndex(i, lldb.eDynamicDontRunTarget, True)
+ check = ValueCheck(
+ name=f"[{i}]",
+ type="Point",
+ children=[
+ ValueCheck(name="x", value=str(2 * i + 1)),
+ ValueCheck(name="y", value=str(2 * i + 2)),
+ ],
+ )
+ check.check_value(self, child, f"{child}, child {i} of {v.GetName()}")
+
+ int_arr = self.frame().FindVariable("int_arr")
+ int_ptr = self.frame().FindVariable("int_ptr")
+ for v in [int_arr, int_ptr]:
+ for i in range(3):
+ child = v.GetChildAtIndex(i, lldb.eDynamicDontRunTarget, True)
+ check = ValueCheck(name=f"[{i}]", type="int", value=str(i + 1))
+ check.check_value(self, child, f"{child}, child {i} of {v.GetName()}")
diff --git a/lldb/test/API/python_api/sbvalue_synthetic/main.cpp b/lldb/test/API/python_api/sbvalue_synthetic/main.cpp
index 52c6474d7a1b..d9b65f017a30 100644
--- a/lldb/test/API/python_api/sbvalue_synthetic/main.cpp
+++ b/lldb/test/API/python_api/sbvalue_synthetic/main.cpp
@@ -6,8 +6,17 @@ struct HasFoo {
Foo f;
};
+struct Point {
+ int x;
+ int y;
+};
+
int main() {
Foo foo;
HasFoo has_foo;
+ Point point_arr[] = {{1, 2}, {3, 4}, {5, 6}};
+ int int_arr[] = {1, 2, 3, 4, 5, 6};
+ Point *point_ptr = point_arr;
+ int *int_ptr = int_arr;
return 0; // break here
}