diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2012-03-16 21:55:42 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2012-03-16 21:55:42 +0000 |
| commit | 1b72f09150b1333e33773882e9c035ac896acc5e (patch) | |
| tree | 2d03ba33e15db13fdbd92fb68812690f937f9ed6 /lldb/test/python_api/module_section | |
| parent | f6af30f4c7d91d61d2ccb7cdb450872c11eef214 (diff) | |
| download | bcm5719-llvm-1b72f09150b1333e33773882e9c035ac896acc5e.tar.gz bcm5719-llvm-1b72f09150b1333e33773882e9c035ac896acc5e.zip | |
Export the APIs submitted by Dawn to the Python bindings. Add a simple test case for the SBModule.compile_unit_iter() API.
llvm-svn: 152952
Diffstat (limited to 'lldb/test/python_api/module_section')
| -rw-r--r-- | lldb/test/python_api/module_section/Makefile | 2 | ||||
| -rw-r--r-- | lldb/test/python_api/module_section/TestModuleAndSection.py | 32 | ||||
| -rw-r--r-- | lldb/test/python_api/module_section/b.cpp | 3 | ||||
| -rw-r--r-- | lldb/test/python_api/module_section/c.cpp | 3 |
4 files changed, 39 insertions, 1 deletions
diff --git a/lldb/test/python_api/module_section/Makefile b/lldb/test/python_api/module_section/Makefile index 86af2f4bc70..5738d5684da 100644 --- a/lldb/test/python_api/module_section/Makefile +++ b/lldb/test/python_api/module_section/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../make -CXX_SOURCES := main.cpp +CXX_SOURCES := main.cpp b.cpp c.cpp MAKE_DSYM :=NO include $(LEVEL)/Makefile.rules diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py index ebd0ea04909..7038d6e7109 100644 --- a/lldb/test/python_api/module_section/TestModuleAndSection.py +++ b/lldb/test/python_api/module_section/TestModuleAndSection.py @@ -25,6 +25,12 @@ class ModuleAndSectionAPIsTestCase(TestBase): self.buildDefault() self.module_and_section_boundary_condition() + @python_api_test + def test_module_compile_unit_iter(self): + """Test module's compile unit iterator APIs.""" + self.buildDefault() + self.module_compile_unit_iter() + def module_and_section(self): exe = os.path.join(os.getcwd(), "a.out") @@ -100,6 +106,32 @@ class ModuleAndSectionAPIsTestCase(TestBase): if sec1: sec1.FindSubSection(None) + def module_compile_unit_iter(self): + exe = os.path.join(os.getcwd(), "a.out") + + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + self.assertTrue(target.GetNumModules() > 0) + + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + + print "Number of modules for the target: %d" % target.GetNumModules() + for module in target.module_iter(): + print module + + # Get the executable module at index 0. + exe_module = target.GetModuleAtIndex(0) + + print "Exe module: %s" % str(exe_module) + print "Number of compile units: %d" % exe_module.GetNumCompileUnits() + INDENT = ' ' * 4 + INDENT2 = INDENT * 2 + for cu in exe_module.compile_unit_iter(): + print cu + + if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() diff --git a/lldb/test/python_api/module_section/b.cpp b/lldb/test/python_api/module_section/b.cpp new file mode 100644 index 00000000000..4e3e54138e5 --- /dev/null +++ b/lldb/test/python_api/module_section/b.cpp @@ -0,0 +1,3 @@ +int b_function(int input) { + return input * 2; +} diff --git a/lldb/test/python_api/module_section/c.cpp b/lldb/test/python_api/module_section/c.cpp new file mode 100644 index 00000000000..3c87bfe30c6 --- /dev/null +++ b/lldb/test/python_api/module_section/c.cpp @@ -0,0 +1,3 @@ +int c_function(int input) { + return input * 3; +} |

