diff options
author | Alexander Polyakov <polyakov.alx@gmail.com> | 2018-07-03 14:22:44 +0000 |
---|---|---|
committer | Alexander Polyakov <polyakov.alx@gmail.com> | 2018-07-03 14:22:44 +0000 |
commit | da0c081f7e363497a150f3bb14b9460bfc495a6d (patch) | |
tree | 0cb7bc7a67f0979577219aefe84b8abaf1a0f84b /lldb/packages/Python/lldbsuite/test/python_api/module_section | |
parent | b5d6e76bb7baba6885e92d0f8d639bf2b1da379d (diff) | |
download | bcm5719-llvm-da0c081f7e363497a150f3bb14b9460bfc495a6d.tar.gz bcm5719-llvm-da0c081f7e363497a150f3bb14b9460bfc495a6d.zip |
Add new API to SBTarget and SBModule classes.
Summary: The new API allows to find a list of compile units related to target/module.
Reviewers: aprantl, clayborg
Reviewed By: aprantl
Subscribers: jingham, lldb-commits
Differential Revision: https://reviews.llvm.org/D48801
llvm-svn: 336200
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.py | 26 |
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) |