summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/default-constructor
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2017-09-14 20:22:49 +0000
committerJim Ingham <jingham@apple.com>2017-09-14 20:22:49 +0000
commitb842f2ecf005db63713e5d939b9a2a10d912cb2b (patch)
tree2a35a44b6a54b12f4d373bff208778004eae72fe /lldb/packages/Python/lldbsuite/test/python_api/default-constructor
parentb2388c52e8efdaa34818ae9798d434c0d5e88814 (diff)
downloadbcm5719-llvm-b842f2ecf005db63713e5d939b9a2a10d912cb2b.tar.gz
bcm5719-llvm-b842f2ecf005db63713e5d939b9a2a10d912cb2b.zip
Make breakpoint names real entities.
When introduced, breakpoint names were just tags that you could apply to breakpoints that would allow you to refer to a breakpoint when you couldn't capture the ID, or to refer to a collection of breakpoints. This change makes the names independent holders of breakpoint options that you can then apply to breakpoints when you add the name to the breakpoint. It adds the "breakpoint name configure" command to set up or reconfigure breakpoint names. There is also full support for then in the SB API, including a new SBBreakpointName class. The connection between the name and the breakpoints sharing the name remains live, so if you reconfigure the name, all the breakpoint options all change as well. This allows a quick way to share complex breakpoint behavior among a bunch of breakpoints, and a convenient way to iterate on the set. You can also create a name from a breakpoint, allowing a quick way to copy options from one breakpoint to another. I also added the ability to make hidden and delete/disable protected names. When applied to a breakpoint, you will only be able to list, delete or disable that breakpoint if you refer to it explicitly by ID. This feature will allow GUI's that need to use breakpoints for their own purposes to keep their breakpoints from getting accidentally disabled or deleted. <rdar://problem/22094452> llvm-svn: 313292
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor')
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py11
-rw-r--r--lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py42
2 files changed, 53 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index bea9f5962d6..5c0c7bbd766 100644
--- a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -73,6 +73,17 @@ class APIDefaultConstructorTestCase(TestBase):
@add_test_categories(['pyapi'])
@no_debug_info_test
+ def test_SBBreakpointName(self):
+ obj = lldb.SBBreakpointName()
+ if self.TraceOn():
+ print(obj)
+ self.assertFalse(obj)
+ # Do fuzz testing on the invalid obj, it should not crash lldb.
+ import sb_breakpointname
+ sb_breakpointname.fuzz_obj(obj)
+
+ @add_test_categories(['pyapi'])
+ @no_debug_info_test
def test_SBBroadcaster(self):
obj = lldb.SBBroadcaster()
if self.TraceOn():
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py
new file mode 100644
index 00000000000..56016c05c31
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py
@@ -0,0 +1,42 @@
+"""
+Fuzz tests an object after the default construction to make sure it does not crash lldb.
+"""
+
+import sys
+import lldb
+
+
+def fuzz_obj(obj):
+ obj.IsValid()
+ obj.GetName()
+ obj.SetEnabled(True)
+ obj.IsEnabled()
+ obj.SetOneShot(True)
+ obj.IsOneShot()
+ obj.SetIgnoreCount(1)
+ obj.GetIgnoreCount()
+ obj.SetCondition("1 == 2")
+ obj.GetCondition()
+ obj.SetAutoContinue(False)
+ obj.GetAutoContinue()
+ obj.SetThreadID(0x1234)
+ obj.GetThreadID()
+ obj.SetThreadIndex(10)
+ obj.GetThreadIndex()
+ obj.SetThreadName("AThread")
+ obj.GetThreadName()
+ obj.SetQueueName("AQueue")
+ obj.GetQueueName()
+ obj.SetScriptCallbackFunction("AFunction")
+ commands = lldb.SBStringList()
+ obj.SetCommandLineCommands(commands)
+ obj.GetCommandLineCommands(commands)
+ obj.SetScriptCallbackBody("Insert Python Code here")
+ obj.GetAllowList()
+ obj.SetAllowList(False)
+ obj.GetAllowDelete()
+ obj.SetAllowDelete(False)
+ obj.GetAllowDisable()
+ obj.SetAllowDisable(False)
+ stream = lldb.SBStream()
+ obj.GetDescription(stream)
OpenPOWER on IntegriCloud