diff options
| -rw-r--r-- | lldb/test/python_api/target/TestTargetAPI.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py index b916cb548b6..3cfe011816e 100644 --- a/lldb/test/python_api/target/TestTargetAPI.py +++ b/lldb/test/python_api/target/TestTargetAPI.py @@ -16,14 +16,20 @@ class TargetAPITestCase(TestBase): @python_api_test def test_find_global_variables_with_dsym(self): """Exercise SBTaget.FindGlobalVariables() API.""" - self.buildDsym() - self.find_global_variables() + d = {'EXE': 'a.out'} + self.buildDsym(dictionary=d) + self.setTearDownCleanup(dictionary=d) + self.find_global_variables('a.out') + #rdar://problem/9700873 + @unittest2.skip("segmentation fault -- skipping") @python_api_test def test_find_global_variables_with_dwarf(self): """Exercise SBTarget.FindGlobalVariables() API.""" - self.buildDwarf() - self.find_global_variables() + d = {'EXE': 'b.out'} + self.buildDwarf(dictionary=d) + self.setTearDownCleanup(dictionary=d) + self.find_global_variables('b.out') @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test @@ -71,15 +77,15 @@ 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): + def find_global_variables(self, exe_name): """Exercise SBTaget.FindGlobalVariables() API.""" - exe = os.path.join(os.getcwd(), "a.out") + exe = os.path.join(os.getcwd(), exe_name) # 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) + 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.expect(my_global_var.GetName(), exe=False, @@ -89,6 +95,14 @@ class TargetAPITestCase(TestBase): self.expect(my_global_var.GetValue(), exe=False, startstr = "'X'") + # While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API. + for m in target.module_iter(): + if m.GetFileSpec().GetDirectory() == os.getcwd() and m.GetFileSpec().GetFilename() == exe_name: + value_list = m.FindGlobalVariables(target, 'my_global_var_of_char_type', 3) + self.assertTrue(value_list.GetSize() == 1) + self.assertTrue(value_list.GetValueAtIndex(0).GetValue() == "'X'") + break + def get_description(self): """Exercise SBTaget.GetDescription() API.""" exe = os.path.join(os.getcwd(), "a.out") |

