summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-07-07 22:22:51 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-07-07 22:22:51 +0000
commit4bc80decfbb2b4a904e8abb122cac5c0f3294666 (patch)
tree277b7822d88ea381e3f4958c6fadc0d92b184da1
parent28d6677a53f3d12ac36e5a992da27d2a6572ebd8 (diff)
downloadbcm5719-llvm-4bc80decfbb2b4a904e8abb122cac5c0f3294666.tar.gz
bcm5719-llvm-4bc80decfbb2b4a904e8abb122cac5c0f3294666.zip
Add test cases to exercise the SBTarget.FindFunctions() API.
llvm-svn: 134646
-rw-r--r--lldb/test/python_api/target/TestTargetAPI.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index 3cfe011816e..06c836d38db 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -33,6 +33,23 @@ class TargetAPITestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
+ def test_find_functions_with_dsym(self):
+ """Exercise SBTaget.FindFunctions() API."""
+ d = {'EXE': 'a.out'}
+ self.buildDsym(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.find_functions('a.out')
+
+ @python_api_test
+ def test_find_functions_with_dwarf(self):
+ """Exercise SBTarget.FindFunctions() API."""
+ d = {'EXE': 'b.out'}
+ self.buildDwarf(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ self.find_functions('b.out')
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @python_api_test
def test_get_description_with_dsym(self):
"""Exercise SBTaget.GetDescription() API."""
self.buildDsym()
@@ -88,6 +105,7 @@ class TargetAPITestCase(TestBase):
value_list = target.FindGlobalVariables('my_global_var_of_char_type', 3)
self.assertTrue(value_list.GetSize() == 1)
my_global_var = value_list.GetValueAtIndex(0)
+ self.assertTrue(my_global_var)
self.expect(my_global_var.GetName(), exe=False,
startstr = "my_global_var_of_char_type")
self.expect(my_global_var.GetTypeName(), exe=False,
@@ -103,6 +121,21 @@ class TargetAPITestCase(TestBase):
self.assertTrue(value_list.GetValueAtIndex(0).GetValue() == "'X'")
break
+ def find_functions(self, exe_name):
+ """Exercise SBTaget.FindFunctions() API."""
+ exe = os.path.join(os.getcwd(), exe_name)
+
+ # Create a target by the debugger.
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ list = lldb.SBSymbolContextList()
+ num = target.FindFunctions('c', lldb.eFunctionNameTypeAuto, False, list)
+ self.assertTrue(num == 1 and list.GetSize() == 1)
+
+ for sc in list:
+ self.assertTrue(sc.GetSymbol().GetName() == 'c')
+
def get_description(self):
"""Exercise SBTaget.GetDescription() API."""
exe = os.path.join(os.getcwd(), "a.out")
OpenPOWER on IntegriCloud