summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api/target/TestTargetAPI.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-07-11 19:15:11 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-07-11 19:15:11 +0000
commit56b92a7b04f4d8a3c30a11470833ec2cba32df96 (patch)
treed396a0e11473e40f222dd57a48b1b66df4c0b4be /lldb/test/python_api/target/TestTargetAPI.py
parent39c0482680d4f59127242c796c94950d8d40e939 (diff)
downloadbcm5719-llvm-56b92a7b04f4d8a3c30a11470833ec2cba32df96.tar.gz
bcm5719-llvm-56b92a7b04f4d8a3c30a11470833ec2cba32df96.zip
Update the test scenario for find_global_variables() to now start the inferior process
before issuing API calls to find the global variable and to get its value. rdar://problem/9700873 has been updated to reflect the latest status. The dwarf case now does not seg fault if the inferior is not started; instead, for dwarf case, the value retrieved from the global variable is None. llvm-svn: 134909
Diffstat (limited to 'lldb/test/python_api/target/TestTargetAPI.py')
-rw-r--r--lldb/test/python_api/target/TestTargetAPI.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index 6c2c4fd4784..81d250b497f 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -22,7 +22,12 @@ class TargetAPITestCase(TestBase):
self.find_global_variables('a.out')
#rdar://problem/9700873
- @unittest2.skip("segmentation fault -- skipping")
+ # Find global variable value fails for dwarf if inferior not started
+ # (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
+ #
+ # It does not segfaults now. But for dwarf, the variable value is None if
+ # the inferior process does not exist yet. The radar has been updated.
+ #@unittest232.skip("segmentation fault -- skipping")
@python_api_test
def test_find_global_variables_with_dwarf(self):
"""Exercise SBTarget.FindGlobalVariables() API."""
@@ -102,9 +107,24 @@ class TargetAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
+ #rdar://problem/9700873
+ # Find global variable value fails for dwarf if inferior not started
+ # (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
+ #
+ # Remove the lines to create a breakpoint and to start the inferior
+ # which are workarounds for the dwarf case.
+
+ breakpoint = target.BreakpointCreateByLocation('main.c', self.line1)
+ self.assertTrue(breakpoint, VALID_BREAKPOINT)
+
+ # Now launch the process, and do not stop at entry point.
+ process = target.LaunchSimple(None, None, os.getcwd())
+ self.assertTrue(process, PROCESS_IS_VALID)
+
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.DebugSBValue(my_global_var)
self.assertTrue(my_global_var)
self.expect(my_global_var.GetName(), exe=False,
startstr = "my_global_var_of_char_type")
OpenPOWER on IntegriCloud