summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/target/TestTargetAPI.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-06-29 22:45:06 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-06-29 22:45:06 +0000
commit466c593912db9b4a90d31bd871b6fbd2d343cf7e (patch)
treea4444dbb424a0a7b75210cedb1e8b2691966c6dd /lldb/test/python_api/target/TestTargetAPI.py
parent4becb37e345b95b00774e9e0a12d1f40776c175a (diff)
downloadbcm5719-llvm-466c593912db9b4a90d31bd871b6fbd2d343cf7e.tar.gz
bcm5719-llvm-466c593912db9b4a90d31bd871b6fbd2d343cf7e.zip
Add test cases to TestTargetAPI.py to exercise the newly added SBTarget.FindGlobalVariables() API.
llvm-svn: 134109
Diffstat (limited to 'lldb/test/python_api/target/TestTargetAPI.py')
-rw-r--r--lldb/test/python_api/target/TestTargetAPI.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index b6fab12a321..b916cb548b6 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -14,6 +14,19 @@ class TargetAPITestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@python_api_test
+ def test_find_global_variables_with_dsym(self):
+ """Exercise SBTaget.FindGlobalVariables() API."""
+ self.buildDsym()
+ self.find_global_variables()
+
+ @python_api_test
+ def test_find_global_variables_with_dwarf(self):
+ """Exercise SBTarget.FindGlobalVariables() API."""
+ self.buildDwarf()
+ self.find_global_variables()
+
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ @python_api_test
def test_get_description_with_dsym(self):
"""Exercise SBTaget.GetDescription() API."""
self.buildDsym()
@@ -58,6 +71,24 @@ class TargetAPITestCase(TestBase):
self.line1 = line_number('main.c', '// Find the line number for breakpoint 1 here.')
self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
+ def find_global_variables(self):
+ """Exercise SBTaget.FindGlobalVariables() API."""
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ # Create a target by the debugger.
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ value_list = target.FindGlobalVariables('my_global_var_of_char_type', 1)
+ self.assertTrue(value_list.GetSize() == 1)
+ my_global_var = value_list.GetValueAtIndex(0)
+ self.expect(my_global_var.GetName(), exe=False,
+ startstr = "my_global_var_of_char_type")
+ self.expect(my_global_var.GetTypeName(), exe=False,
+ startstr = "char")
+ self.expect(my_global_var.GetValue(), exe=False,
+ startstr = "'X'")
+
def get_description(self):
"""Exercise SBTaget.GetDescription() API."""
exe = os.path.join(os.getcwd(), "a.out")
OpenPOWER on IntegriCloud