summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py144
1 files changed, 99 insertions, 45 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
index 3f8a39388e6..e609d8ec4cc 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/serialize/TestBreakpointSerialization.py
@@ -1,5 +1,5 @@
"""
-Test breakpoint ignore count features.
+Test breakpoint serialization.
"""
from __future__ import print_function
@@ -25,34 +25,28 @@ class BreakpointSerialization(TestBase):
self.setup_targets_and_cleanup()
self.do_check_resolvers()
- def not_test_filters(self):
+ def test_filters(self):
"""Use Python APIs to test that we serialize search filters correctly."""
self.build()
self.setup_targets_and_cleanup()
- self.check_filters()
+ self.do_check_filters()
- def not_test_options(self):
+ def test_options(self):
"""Use Python APIs to test that we serialize breakpoint options correctly."""
self.build()
self.setup_targets_and_cleanup()
- self.check_filters()
-
- def not_test_complex(self):
- """Use Python APIs to test that we serialize complex breakpoints correctly."""
- self.build()
- self.setup_targets_and_cleanup()
- self.check_filters()
+ self.do_check_options()
def setup_targets_and_cleanup(self):
def cleanup ():
- #self.RemoveTempFile(self.bkpts_file_path)
+ self.RemoveTempFile(self.bkpts_file_path)
if self.orig_target.IsValid():
self.dbg.DeleteTarget(self.orig_target)
self.dbg.DeleteTarget(self.copy_target)
self.addTearDownHook(cleanup)
- #self.RemoveTempFile(self.bkpts_file_path)
+ self.RemoveTempFile(self.bkpts_file_path)
exe = os.path.join(os.getcwd(), "a.out")
@@ -70,23 +64,10 @@ class BreakpointSerialization(TestBase):
self.bkpts_file_path = os.path.join(os.getcwd(), "breakpoints.json")
self.bkpts_file_spec = lldb.SBFileSpec(self.bkpts_file_path)
- def do_check_resolvers(self):
- """Use Python APIs to check serialization of breakpoint resolvers"""
-
- empty_module_list = lldb.SBFileSpecList()
- empty_cu_list = lldb.SBFileSpecList()
- blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
-
- # It isn't actually important for these purposes that these breakpoint
- # actually have locations.
- source_bps = lldb.SBBreakpointList(self.orig_target)
- source_bps.Append(self.orig_target.BreakpointCreateByLocation("blubby.c", 666))
- source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list))
- source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list))
- source_bps.Append(self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec))
+ def check_equivalence(self, source_bps):
error = lldb.SBError()
- error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec)
+ error = self.orig_target.BreakpointsWriteToFile(self.bkpts_file_spec, source_bps)
self.assertTrue(error.Success(), "Failed writing breakpoints to file: %s."%(error.GetCString()))
copy_bps = lldb.SBBreakpointList(self.copy_target)
@@ -116,32 +97,105 @@ class BreakpointSerialization(TestBase):
copy_text = copy_desc.GetData()
# These two should be identical.
- print ("Source test for %d is %s."%(i, source_text))
+ # print ("Source text for %d is %s."%(i, source_text))
self.assertTrue (source_text == copy_text, "Source and dest breakpoints are not identical: \nsource: %s\ndest: %s"%(source_text, copy_text))
- def check_filters(self):
+ def do_check_resolvers(self):
+ """Use Python APIs to check serialization of breakpoint resolvers"""
+
+ empty_module_list = lldb.SBFileSpecList()
+ empty_cu_list = lldb.SBFileSpecList()
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
+
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+ source_bps.Append(self.orig_target.BreakpointCreateByLocation("blubby.c", 666))
+ # Make sure we do one breakpoint right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list))
+ source_bps.Append(self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list))
+ source_bps.Append(self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec))
+
+ # And some number greater than one:
+ self.check_equivalence(source_bps)
+
+ def do_check_filters(self):
"""Use Python APIs to check serialization of breakpoint filters."""
- exe = os.path.join(os.getcwd(), "a.out")
+ module_list = lldb.SBFileSpecList()
+ module_list.Append(lldb.SBFileSpec("SomeBinary"))
+ module_list.Append(lldb.SBFileSpec("SomeOtherBinary"))
+
+ cu_list = lldb.SBFileSpecList()
+ cu_list.Append(lldb.SBFileSpec("SomeCU.c"))
+ cu_list.Append(lldb.SBFileSpec("AnotherCU.c"))
+ cu_list.Append(lldb.SBFileSpec("ThirdCU.c"))
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
- def check_options(self):
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+ bkpt = self.orig_target.BreakpointCreateByLocation(blubby_file_spec, 666, 0, module_list)
+ source_bps.Append(bkpt)
+
+ # Make sure we do one right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, module_list, cu_list)
+ source_bps.Append(bkpt)
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, module_list, cu_list)
+ source_bps.Append(bkpt)
+ bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec)
+ source_bps.Append(bkpt)
+
+ # And some number greater than one:
+ self.check_equivalence(source_bps)
+
+ def do_check_options(self):
"""Use Python APIs to check serialization of breakpoint options."""
- exe = os.path.join(os.getcwd(), "a.out")
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
+ empty_module_list = lldb.SBFileSpecList()
+ empty_cu_list = lldb.SBFileSpecList()
+ blubby_file_spec = lldb.SBFileSpec(os.path.join(os.getcwd(), "blubby.c"))
- def check_resolvers(self):
- """Use Python APIs to check serialization of breakpoint resolvers."""
- exe = os.path.join(os.getcwd(), "a.out")
+ # It isn't actually important for these purposes that these breakpoint
+ # actually have locations.
+ source_bps = lldb.SBBreakpointList(self.orig_target)
+
+ bkpt = self.orig_target.BreakpointCreateByLocation("blubby.c", 666)
+ bkpt.SetEnabled(False)
+ bkpt.SetOneShot(True)
+ source_bps.Append(bkpt)
+
+ # Make sure we get one right:
+ self.check_equivalence(source_bps)
+ source_bps.Clear()
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeAuto, empty_module_list, empty_cu_list)
+ bkpt.SetIgnoreCount(10)
+ source_bps.Append(bkpt)
+
+ bkpt = self.orig_target.BreakpointCreateByName("blubby", lldb.eFunctionNameTypeFull, empty_module_list,empty_cu_list)
+ bkpt.SetCondition("something != something_else")
+ bkpt.AddName("FirstName")
+ bkpt.AddName("SecondName")
+
+ source_bps.Append(bkpt)
+
+ bkpt = self.orig_target.BreakpointCreateBySourceRegex("dont really care", blubby_file_spec)
+ cmd_list = lldb.SBStringList()
+ cmd_list.AppendString("frame var")
+ cmd_list.AppendString("thread backtrace")
+
+ bkpt.SetCommandLineCommands(cmd_list)
+ source_bps.Append(bkpt)
+
+ self.check_equivalence(source_bps)
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
OpenPOWER on IntegriCloud