39 lines · python
1"""2Test that parray of a struct with an embedded char array works.3This was failing because the "live address" of the child elements4was calculated incorrectly - as a offset from the pointer live 5address. It only happened for char[] children because they used6GetAddressOf which relies on the live address.7"""8 9 10import lldb11import lldbsuite.test.lldbutil as lldbutil12from lldbsuite.test.lldbtest import *13 14 15class TestParrayVrsCharArrayChild(TestBase):16 NO_DEBUG_INFO_TESTCASE = True17 18 def test_parray_struct_with_char_array_child(self):19 """This is the basic test for does parray get the char values right."""20 self.build()21 self.main_source_file = lldb.SBFileSpec("main.c")22 self.do_array_test()23 24 def do_array_test(self):25 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(26 self, "Set a breakpoint here", self.main_source_file27 )28 29 frame = thread.GetFrameAtIndex(0)30 31 self.expect(32 "expr -Z 3 -- struct_ptr",33 substrs=[34 'before = 112, var = "abcd", after = 221',35 'before = 313, var = "efgh", after = 414',36 'before = 515, var = "ijkl", after = 616',37 ],38 )39