From b842f2ecf005db63713e5d939b9a2a10d912cb2b Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Thu, 14 Sep 2017 20:22:49 +0000 Subject: 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. llvm-svn: 313292 --- .../TestDefaultConstructorForAPIObjects.py | 11 ++++++ .../default-constructor/sb_breakpointname.py | 42 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointname.py (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor') 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 @@ -71,6 +71,17 @@ class APIDefaultConstructorTestCase(TestBase): import sb_breakpointlocation sb_breakpointlocation.fuzz_obj(obj) + @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): 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) -- cgit v1.2.3