diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-06-29 22:45:06 +0000 | 
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-06-29 22:45:06 +0000 | 
| commit | 466c593912db9b4a90d31bd871b6fbd2d343cf7e (patch) | |
| tree | a4444dbb424a0a7b75210cedb1e8b2691966c6dd /lldb/test/python_api/target | |
| parent | 4becb37e345b95b00774e9e0a12d1f40776c175a (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | lldb/test/python_api/target/TestTargetAPI.py | 31 | ||||
| -rw-r--r-- | lldb/test/python_api/target/main.c | 2 | 
2 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 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") diff --git a/lldb/test/python_api/target/main.c b/lldb/test/python_api/target/main.c index aa9fc092627..7934d30e886 100644 --- a/lldb/test/python_api/target/main.c +++ b/lldb/test/python_api/target/main.c @@ -18,6 +18,8 @@  //  // The two symbol context should point to the same symbol, i.e., 'a' function. +char my_global_var_of_char_type = 'X'; // Test SBTarget.FindGlobalVariables(...). +  int a(int);  int b(int);  int c(int);  | 

