summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/module_section
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/module_section')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py b/lldb/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
index 654387fdf87..65b159974c0 100644
--- a/lldb/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
+++ b/lldb/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
@@ -141,3 +141,29 @@ class ModuleAndSectionAPIsTestCase(TestBase):
INDENT2 = INDENT * 2
for cu in exe_module.compile_unit_iter():
print(cu)
+
+ @add_test_categories(['pyapi'])
+ def test_find_compile_units(self):
+ """Exercise SBModule.FindCompileUnits() API."""
+ d = {'EXE': 'b.out'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.find_compile_units(self.getBuildArtifact('b.out'))
+
+ def find_compile_units(self, exe):
+ """Exercise SBModule.FindCompileUnits() API."""
+ source_name_list = ["main.cpp", "b.cpp", "c.cpp"]
+
+ # Create a target by the debugger.
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ num_modules = target.GetNumModules()
+ for i in range(num_modules):
+ module = target.GetModuleAtIndex(i)
+ for source_name in source_name_list:
+ list = module.FindCompileUnits(lldb.SBFileSpec(source_name, False))
+ for sc in list:
+ self.assertTrue(
+ sc.GetCompileUnit().GetFileSpec().GetFilename() ==
+ source_name)
OpenPOWER on IntegriCloud