5 from __future__ import print_function
9 from lldbsuite.test.lldbtest import *
11 class SectionAPITestCase(TestBase):
13 mydir = TestBase.compute_mydir(__file__)
15 @add_test_categories(['pyapi'])
16 def test_get_target_byte_size(self):
18 self.build(dictionary=d)
19 self.setTearDownCleanup(dictionary=d)
20 exe = os.path.join(os.getcwd(), 'b.out')
21 target = self.dbg.CreateTarget(exe)
22 self.assertTrue(target, VALID_TARGET)
24 # find the .data section of the main module
25 mod = target.GetModuleAtIndex(0)
27 for s in mod.sections:
28 sect_type = s.GetSectionType()
29 if sect_type == lldb.eSectionTypeData:
32 elif sect_type == lldb.eSectionTypeContainer:
33 for i in range(s.GetNumSubSections()):
34 ss = s.GetSubSectionAtIndex(i)
35 sect_type = ss.GetSectionType()
36 if sect_type == lldb.eSectionTypeData:
40 self.assertIsNotNone(data_section)
41 self.assertEqual(data_section.target_byte_size, 1)