summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/module_section/TestModuleAndSection.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
committerZachary Turner <zturner@google.com>2015-10-28 17:43:26 +0000
commitc432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (patch)
tree4efa528e074a6e2df782345e4cd97f5d85d038c4 /lldb/test/python_api/module_section/TestModuleAndSection.py
parenta8a3bd210086b50242903ed95048fe5e53897878 (diff)
downloadbcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.tar.gz
bcm5719-llvm-c432c8f856e0bd84de980a9d9bb2d31b06fa95b1.zip
Move lldb/test to lldb/packages/Python/lldbsuite/test.
This is the conclusion of an effort to get LLDB's Python code structured into a bona-fide Python package. This has a number of benefits, but most notably the ability to more easily share Python code between different but related pieces of LLDB's Python infrastructure (for example, `scripts` can now share code with `test`). llvm-svn: 251532
Diffstat (limited to 'lldb/test/python_api/module_section/TestModuleAndSection.py')
-rw-r--r--lldb/test/python_api/module_section/TestModuleAndSection.py127
1 files changed, 0 insertions, 127 deletions
diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py
deleted file mode 100644
index 5af54537b26..00000000000
--- a/lldb/test/python_api/module_section/TestModuleAndSection.py
+++ /dev/null
@@ -1,127 +0,0 @@
-"""
-Test some SBModule and SBSection APIs.
-"""
-
-from __future__ import print_function
-
-import use_lldb_suite
-
-import os, time
-import re
-import lldb
-from lldbtest import *
-from lldbutil import symbol_type_to_str
-
-class ModuleAndSectionAPIsTestCase(TestBase):
-
- mydir = TestBase.compute_mydir(__file__)
-
- @add_test_categories(['pyapi'])
- def test_module_and_section(self):
- """Test module and section APIs."""
- self.build()
- 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 sections: %d" % exe_module.GetNumSections())
- INDENT = ' ' * 4
- INDENT2 = INDENT * 2
- for sec in exe_module.section_iter():
- print(sec)
- print(INDENT + "Number of subsections: %d" % sec.GetNumSubSections())
- if sec.GetNumSubSections() == 0:
- for sym in exe_module.symbol_in_section_iter(sec):
- print(INDENT + str(sym))
- print(INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
- else:
- for subsec in sec:
- print(INDENT + str(subsec))
- # Now print the symbols belonging to the subsection....
- for sym in exe_module.symbol_in_section_iter(subsec):
- print(INDENT2 + str(sym))
- print(INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
-
- @add_test_categories(['pyapi'])
- def test_module_and_section_boundary_condition(self):
- """Test module and section APIs by passing None when it expects a Python string."""
- self.build()
- 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 sections: %d" % exe_module.GetNumSections())
-
- # Boundary condition testings. Should not crash lldb!
- exe_module.FindFirstType(None)
- exe_module.FindTypes(None)
- exe_module.FindGlobalVariables(target, None, 1)
- exe_module.FindFunctions(None, 0)
- exe_module.FindSection(None)
-
- # Get the section at index 1.
- if exe_module.GetNumSections() > 1:
- sec1 = exe_module.GetSectionAtIndex(1)
- print(sec1)
- else:
- sec1 = None
-
- if sec1:
- sec1.FindSubSection(None)
-
- @add_test_categories(['pyapi'])
- def test_module_compile_unit_iter(self):
- """Test module's compile unit iterator APIs."""
- self.build()
- 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)
-
OpenPOWER on IntegriCloud