diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api/default-constructor')
30 files changed, 1173 insertions, 0 deletions
| diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py new file mode 100644 index 0000000000000..aa3a6141326ae --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -0,0 +1,395 @@ +""" +Test lldb Python API object's default constructor and make sure it is invalid +after initial construction. + +There are also some cases of boundary condition testings sprinkled throughout +the tests where None is passed to SB API which expects (const char *) in the +C++ API counterpart.  Passing None should not crash lldb! + +There are three exceptions to the above general rules, though; API objects +SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects +after default construction. +""" + +from __future__ import print_function + + + +import os, time +import re +import lldb +import lldbsuite.test.lldbutil as lldbutil +from lldbsuite.test.lldbtest import * + +class APIDefaultConstructorTestCase(TestBase): + +    mydir = TestBase.compute_mydir(__file__) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBAddress(self): +        obj = lldb.SBAddress() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_address +        sb_address.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBBlock(self): +        obj = lldb.SBBlock() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_block +        sb_block.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBBreakpoint(self): +        obj = lldb.SBBreakpoint() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_breakpoint +        sb_breakpoint.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBBreakpointLocation(self): +        obj = lldb.SBBreakpointLocation() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_breakpointlocation +        sb_breakpointlocation.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBBroadcaster(self): +        obj = lldb.SBBroadcaster() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_broadcaster +        sb_broadcaster.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBCommandReturnObject(self): +        """SBCommandReturnObject object is valid after default construction.""" +        obj = lldb.SBCommandReturnObject() +        if self.TraceOn(): +            print(obj) +        self.assertTrue(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBCommunication(self): +        obj = lldb.SBCommunication() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_communication +        sb_communication.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBCompileUnit(self): +        obj = lldb.SBCompileUnit() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_compileunit +        sb_compileunit.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBDebugger(self): +        obj = lldb.SBDebugger() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_debugger +        sb_debugger.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail with 2.0.12 http://llvm.org/pr23488 +    def test_SBError(self): +        obj = lldb.SBError() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_error +        sb_error.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBEvent(self): +        obj = lldb.SBEvent() +        # This is just to test that typemap, as defined in lldb.swig, works. +        obj2 = lldb.SBEvent(0, "abc") +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_event +        sb_event.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    def test_SBFileSpec(self): +        obj = lldb.SBFileSpec() +        # This is just to test that FileSpec(None) does not crash. +        obj2 = lldb.SBFileSpec(None, True) +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_filespec +        sb_filespec.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBFrame(self): +        obj = lldb.SBFrame() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_frame +        sb_frame.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBFunction(self): +        obj = lldb.SBFunction() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_function +        sb_function.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBInstruction(self): +        obj = lldb.SBInstruction() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_instruction +        sb_instruction.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBInstructionList(self): +        obj = lldb.SBInstructionList() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_instructionlist +        sb_instructionlist.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBLineEntry(self): +        obj = lldb.SBLineEntry() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_lineentry +        sb_lineentry.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBListener(self): +        obj = lldb.SBListener() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_listener +        sb_listener.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    # Py3 asserts due to a bug in SWIG.  Trying to upstream a patch to fix this in 3.0.8 +    @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)]) +    def test_SBModule(self): +        obj = lldb.SBModule() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_module +        sb_module.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBProcess(self): +        obj = lldb.SBProcess() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_process +        sb_process.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBSection(self): +        obj = lldb.SBSection() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_section +        sb_section.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBStream(self): +        """SBStream object is valid after default construction.""" +        obj = lldb.SBStream() +        if self.TraceOn(): +            print(obj) +        self.assertTrue(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBStringList(self): +        obj = lldb.SBStringList() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_stringlist +        sb_stringlist.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBSymbol(self): +        obj = lldb.SBSymbol() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_symbol +        sb_symbol.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBSymbolContext(self): +        obj = lldb.SBSymbolContext() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_symbolcontext +        sb_symbolcontext.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBSymbolContextList(self): +        """SBSymbolContextList object is valid after default construction.""" +        obj = lldb.SBSymbolContextList() +        if self.TraceOn(): +            print(obj) +        self.assertTrue(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBTarget(self): +        obj = lldb.SBTarget() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_target +        sb_target.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBThread(self): +        obj = lldb.SBThread() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_thread +        sb_thread.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBType(self): +        try: +            obj = lldb.SBType() +            if self.TraceOn(): +                print(obj) +            self.assertFalse(obj) +            # If we reach here, the test fails. +            self.fail("lldb.SBType() should fail, not succeed!") +        except: +            # Exception is expected. +            return +             +        # Unreachable code because lldb.SBType() should fail. +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_type +        sb_type.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBTypeList(self): +        """SBTypeList object is valid after default construction.""" +        obj = lldb.SBTypeList() +        if self.TraceOn(): +            print(obj) +        self.assertTrue(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBValue(self): +        obj = lldb.SBValue() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_value +        sb_value.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBValueList(self): +        obj = lldb.SBValueList() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_valuelist +        sb_valuelist.fuzz_obj(obj) + +    @add_test_categories(['pyapi']) +    @no_debug_info_test +    def test_SBWatchpoint(self): +        obj = lldb.SBWatchpoint() +        if self.TraceOn(): +            print(obj) +        self.assertFalse(obj) +        # Do fuzz testing on the invalid obj, it should not crash lldb. +        import sb_watchpoint +        sb_watchpoint.fuzz_obj(obj) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py new file mode 100644 index 0000000000000..f0e979543a4c2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py @@ -0,0 +1,22 @@ +""" +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.GetFileAddress() +    obj.GetLoadAddress(lldb.SBTarget()) +    obj.SetLoadAddress(0xffff, lldb.SBTarget()) +    obj.OffsetAddress(sys.maxsize) +    obj.GetDescription(lldb.SBStream()) +    obj.GetSection() +    obj.GetSymbolContext(lldb.eSymbolContextEverything) +    obj.GetModule() +    obj.GetCompileUnit() +    obj.GetFunction() +    obj.GetBlock() +    obj.GetSymbol() +    obj.GetLineEntry() +    obj.Clear() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py new file mode 100644 index 0000000000000..3eeb24b427340 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py @@ -0,0 +1,17 @@ +""" +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.IsInlined() +    obj.GetInlinedName() +    obj.GetInlinedCallSiteFile() +    obj.GetInlinedCallSiteLine() +    obj.GetInlinedCallSiteColumn() +    obj.GetParent() +    obj.GetSibling() +    obj.GetFirstChild() +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py new file mode 100644 index 0000000000000..2c05990edae07 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py @@ -0,0 +1,36 @@ +""" +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.GetID() +    obj.ClearAllBreakpointSites() +    obj.FindLocationByAddress(sys.maxsize) +    obj.FindLocationIDByAddress(sys.maxsize) +    obj.FindLocationByID(0) +    obj.GetLocationAtIndex(0) +    obj.SetEnabled(True) +    obj.IsEnabled() +    obj.GetHitCount() +    obj.SetIgnoreCount(1) +    obj.GetIgnoreCount() +    obj.SetCondition("i >= 10") +    obj.GetCondition() +    obj.SetThreadID(0) +    obj.GetThreadID() +    obj.SetThreadIndex(0) +    obj.GetThreadIndex() +    obj.SetThreadName("worker thread") +    obj.GetThreadName() +    obj.SetQueueName("my queue") +    obj.GetQueueName() +    obj.SetScriptCallbackFunction(None) +    obj.SetScriptCallbackBody (None) +    obj.GetNumResolvedLocations() +    obj.GetNumLocations() +    obj.GetDescription(lldb.SBStream()) +    for bp_loc in obj: +        s = str(bp_loc) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py new file mode 100644 index 0000000000000..2251892643b38 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py @@ -0,0 +1,28 @@ +""" +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.GetAddress() +    obj.GetLoadAddress() +    obj.SetEnabled(True) +    obj.IsEnabled() +    obj.SetCondition("i >= 10") +    obj.GetCondition() +    obj.SetThreadID(0) +    obj.GetThreadID() +    obj.SetThreadIndex(0) +    obj.GetThreadIndex() +    obj.SetThreadName("worker thread") +    obj.GetThreadName() +    obj.SetQueueName("my queue") +    obj.GetQueueName() +    obj.IsResolved() +    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose) +    breakpoint = obj.GetBreakpoint() +    # Do fuzz testing on the breakpoint obj, it should not crash lldb. +    import sb_breakpoint +    sb_breakpoint.fuzz_obj(breakpoint) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py new file mode 100644 index 0000000000000..27539e855cdd2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py @@ -0,0 +1,20 @@ +""" +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.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True) +    obj.BroadcastEvent(lldb.SBEvent(), False) +    listener = lldb.SBListener("fuzz_testing") +    obj.AddInitialEventsToListener(listener, 0xffffffff) +    obj.AddInitialEventsToListener(listener, 0) +    obj.AddListener(listener, 0xffffffff) +    obj.AddListener(listener, 0) +    obj.GetName() +    obj.EventTypeHasListeners(0) +    obj.RemoveListener(listener, 0xffffffff) +    obj.RemoveListener(listener, 0) +    obj.Clear() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py new file mode 100644 index 0000000000000..d4b90840657b4 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py @@ -0,0 +1,28 @@ +""" +Fuzz tests an object after the default construction to make sure it does not crash lldb. +""" + +import sys +import lldb + +def fuzz_obj(obj): +    broadcaster = obj.GetBroadcaster() +    # Do fuzz testing on the broadcaster obj, it should not crash lldb. +    import sb_broadcaster +    sb_broadcaster.fuzz_obj(broadcaster) +    obj.AdoptFileDesriptor(0, False) +    obj.AdoptFileDesriptor(1, False) +    obj.AdoptFileDesriptor(2, False) +    obj.Connect("file:/tmp/myfile") +    obj.Connect(None) +    obj.Disconnect() +    obj.IsConnected() +    obj.GetCloseOnEOF() +    obj.SetCloseOnEOF(True) +    obj.SetCloseOnEOF(False) +    #obj.Write(None, sys.maxint, None) +    #obj.Read(None, sys.maxint, 0xffffffff, None) +    obj.ReadThreadStart() +    obj.ReadThreadStop() +    obj.ReadThreadIsRunning() +    obj.SetReadThreadBytesReceivedCallback(None, None) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py new file mode 100644 index 0000000000000..92755ffa395d2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py @@ -0,0 +1,15 @@ +""" +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.GetFileSpec() +    obj.GetNumLineEntries() +    obj.GetLineEntryAtIndex(0xffffffff) +    obj.FindLineEntryIndex(0, 0xffffffff, None) +    obj.GetDescription(lldb.SBStream()) +    for line_entry in obj: +        s = str(line_entry) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py new file mode 100644 index 0000000000000..e7c188f09bad2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py @@ -0,0 +1,56 @@ +""" +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.SetAsync(True) +    obj.SetAsync(False) +    obj.GetAsync() +    obj.SkipLLDBInitFiles(True) +    obj.SetInputFileHandle(None, True) +    obj.SetOutputFileHandle(None, True) +    obj.SetErrorFileHandle(None, True) +    obj.GetInputFileHandle() +    obj.GetOutputFileHandle() +    obj.GetErrorFileHandle() +    obj.GetCommandInterpreter() +    obj.HandleCommand("nothing here") +    listener = obj.GetListener() +    obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None) +    obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C") +    obj.CreateTargetWithFileAndArch("b.out", "arm") +    obj.CreateTarget("c.out") +    obj.DeleteTarget(lldb.SBTarget()) +    obj.GetTargetAtIndex(0xffffffff) +    obj.FindTargetWithProcessID(0) +    obj.FindTargetWithFileAndArch("a.out", "arm") +    obj.GetNumTargets() +    obj.GetSelectedTarget() +    obj.GetSourceManager() +    obj.SetSelectedTarget(lldb.SBTarget()) +    obj.SetCurrentPlatformSDKRoot("tmp/sdk-root") +    try: +        obj.DispatchInput(None) +    except Exception: +        pass +    obj.DispatchInputInterrupt() +    obj.DispatchInputEndOfFile() +    obj.GetInstanceName() +    obj.GetDescription(lldb.SBStream()) +    obj.GetTerminalWidth() +    obj.SetTerminalWidth(0xffffffff) +    obj.GetID() +    obj.GetPrompt() +    obj.SetPrompt("Hi, Mom!") +    obj.GetScriptLanguage() +    obj.SetScriptLanguage(lldb.eScriptLanguageNone) +    obj.SetScriptLanguage(lldb.eScriptLanguagePython) +    obj.GetCloseInputOnEOF() +    obj.SetCloseInputOnEOF(True) +    obj.SetCloseInputOnEOF(False) +    obj.Clear() +    for target in obj: +        s = str(target) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py new file mode 100644 index 0000000000000..7e069323bf3f9 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py @@ -0,0 +1,25 @@ +""" +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.GetCString() +    obj.Fail() +    obj.Success() +    obj.GetError() +    obj.GetType() +    obj.SetError(5, lldb.eErrorTypeGeneric) +    obj.SetErrorToErrno() +    obj.SetErrorToGenericError() +    obj.SetErrorString("xyz") +    obj.SetErrorString(None) +    obj.SetErrorStringWithFormat("%s!", "error") +    obj.SetErrorStringWithFormat(None) +    obj.SetErrorStringWithFormat("error") +    obj.SetErrorStringWithFormat("%s %s", "warning", "danger") +    obj.SetErrorStringWithFormat("%s %s %s", "danger", "will", "robinson") +    obj.GetDescription(lldb.SBStream()) +    obj.Clear() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py new file mode 100644 index 0000000000000..c64f9ba927c2e --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py @@ -0,0 +1,17 @@ +""" +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.GetDataFlavor() +    obj.GetType() +    broadcaster = obj.GetBroadcaster() +    # Do fuzz testing on the broadcaster obj, it should not crash lldb. +    import sb_broadcaster +    sb_broadcaster.fuzz_obj(broadcaster) +    obj.BroadcasterMatchesRef(broadcaster) +    obj.GetDescription(lldb.SBStream()) +    obj.Clear() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py new file mode 100644 index 0000000000000..3aa9235b8a16d --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py @@ -0,0 +1,14 @@ +""" +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.Exists() +    obj.ResolveExecutableLocation() +    obj.GetFilename() +    obj.GetDirectory() +    obj.GetPath(None, 0) +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py new file mode 100644 index 0000000000000..41edaff02ed79 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py @@ -0,0 +1,37 @@ +""" +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.GetFrameID() +    obj.GetPC() +    obj.SetPC(0xffffffff) +    obj.GetSP() +    obj.GetFP() +    obj.GetPCAddress() +    obj.GetSymbolContext(0) +    obj.GetModule() +    obj.GetCompileUnit() +    obj.GetFunction() +    obj.GetSymbol() +    obj.GetBlock() +    obj.GetFunctionName() +    obj.IsInlined() +    obj.EvaluateExpression("x + y") +    obj.EvaluateExpression("x + y", lldb.eDynamicCanRunTarget) +    obj.GetFrameBlock() +    obj.GetLineEntry() +    obj.GetThread() +    obj.Disassemble() +    obj.GetVariables(True, True, True, True) +    obj.GetVariables(True, True, True, False, lldb.eDynamicCanRunTarget) +    obj.GetRegisters() +    obj.FindVariable("my_var") +    obj.FindVariable("my_var", lldb.eDynamicCanRunTarget) +    obj.FindValue("your_var", lldb.eValueTypeVariableGlobal) +    obj.FindValue("your_var", lldb.eValueTypeVariableStatic, lldb.eDynamicCanRunTarget) +    obj.GetDescription(lldb.SBStream()) +    obj.Clear() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py new file mode 100644 index 0000000000000..fb88d37ac19c2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py @@ -0,0 +1,19 @@ +""" +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.GetName() +    obj.GetMangledName() +    obj.GetInstructions(lldb.SBTarget()) +    sa = obj.GetStartAddress() +    ea = obj.GetEndAddress() +    # Do fuzz testing on the address obj, it should not crash lldb. +    import sb_address +    sb_address.fuzz_obj(sa) +    sb_address.fuzz_obj(ea) +    obj.GetPrologueByteSize +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py new file mode 100644 index 0000000000000..b961bc389e31b --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py @@ -0,0 +1,16 @@ +""" +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.GetAddress() +    obj.GetByteSize() +    obj.DoesBranch() +    obj.Print(None) +    obj.GetDescription(lldb.SBStream()) +    obj.EmulateWithFrame(lldb.SBFrame(), 0) +    obj.DumpEmulation("armv7") +    obj.TestEmulation(lldb.SBStream(), "my-file") diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py new file mode 100644 index 0000000000000..09d62f9704808 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py @@ -0,0 +1,17 @@ +""" +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.GetSize() +    obj.GetInstructionAtIndex(0xffffffff) +    obj.AppendInstruction(lldb.SBInstruction()) +    obj.Print(None) +    obj.GetDescription(lldb.SBStream()) +    obj.DumpEmulationForAllInstructions("armv7") +    obj.Clear() +    for inst in obj: +        s = str(inst) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py new file mode 100644 index 0000000000000..d97f2517f4bc8 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py @@ -0,0 +1,14 @@ +""" +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.GetStartAddress() +    obj.GetEndAddress() +    obj.GetFileSpec() +    obj.GetLine() +    obj.GetColumn() +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py new file mode 100644 index 0000000000000..0747547b9cfd2 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py @@ -0,0 +1,23 @@ +""" +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.AddEvent(lldb.SBEvent()) +    obj.StartListeningForEvents(lldb.SBBroadcaster(), 0xffffffff) +    obj.StopListeningForEvents(lldb.SBBroadcaster(), 0xffffffff) +    event = lldb.SBEvent() +    broadcaster = lldb.SBBroadcaster() +    obj.WaitForEvent(5, event) +    obj.WaitForEventForBroadcaster(5, broadcaster, event) +    obj.WaitForEventForBroadcasterWithType(5, broadcaster, 0xffffffff, event) +    obj.PeekAtNextEvent(event) +    obj.PeekAtNextEventForBroadcaster(broadcaster, event) +    obj.PeekAtNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event) +    obj.GetNextEvent(event) +    obj.GetNextEventForBroadcaster(broadcaster, event) +    obj.GetNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event) +    obj.HandleBroadcastEvent(event) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py new file mode 100644 index 0000000000000..0b9aa99167af4 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py @@ -0,0 +1,29 @@ +""" +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.GetFileSpec() +    obj.GetPlatformFileSpec() +    obj.SetPlatformFileSpec(lldb.SBFileSpec()) +    obj.GetUUIDString() +    obj.ResolveFileAddress(sys.maxsize) +    obj.ResolveSymbolContextForAddress(lldb.SBAddress(), 0) +    obj.GetDescription(lldb.SBStream()) +    obj.GetNumSymbols() +    obj.GetSymbolAtIndex(sys.maxsize) +    sc_list = obj.FindFunctions("my_func") +    sc_list = obj.FindFunctions("my_func", lldb.eFunctionNameTypeAny) +    obj.FindGlobalVariables(lldb.SBTarget(), "my_global_var", 1) +    for section in obj.section_iter(): +        s = str(section) +    for symbol in obj.symbol_in_section_iter(lldb.SBSection()): +        s = str(symbol) +    for symbol in obj: +        s = str(symbol) +    obj.GetAddressByteSize() +    obj.GetByteOrder() +    obj.GetTriple() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py new file mode 100644 index 0000000000000..40132b1995806 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py @@ -0,0 +1,49 @@ +""" +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.GetTarget() +    obj.GetByteOrder() +    obj.PutSTDIN("my data") +    obj.GetSTDOUT(6) +    obj.GetSTDERR(6) +    event = lldb.SBEvent() +    obj.ReportEventState(event, None) +    obj.AppendEventStateReport(event, lldb.SBCommandReturnObject()) +    error = lldb.SBError() +    obj.RemoteAttachToProcessWithID(123, error) +    obj.RemoteLaunch(None, None, None, None, None, None, 0, False, error) +    obj.GetNumThreads() +    obj.GetThreadAtIndex(0) +    obj.GetThreadByID(0) +    obj.GetSelectedThread() +    obj.SetSelectedThread(lldb.SBThread()) +    obj.SetSelectedThreadByID(0) +    obj.GetState() +    obj.GetExitStatus() +    obj.GetExitDescription() +    obj.GetProcessID() +    obj.GetAddressByteSize() +    obj.Destroy() +    obj.Continue() +    obj.Stop() +    obj.Kill() +    obj.Detach() +    obj.Signal(7) +    obj.ReadMemory(0x0000ffff, 10, error) +    obj.WriteMemory(0x0000ffff, "hi data", error) +    obj.ReadCStringFromMemory(0x0, 128, error) +    obj.ReadUnsignedFromMemory(0xff, 4, error) +    obj.ReadPointerFromMemory(0xff, error) +    obj.GetBroadcaster() +    obj.GetDescription(lldb.SBStream()) +    obj.LoadImage(lldb.SBFileSpec(), error) +    obj.UnloadImage(0) +    obj.Clear() +    obj.GetNumSupportedHardwareWatchpoints(error) +    for thread in obj: +        s = str(thread) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py new file mode 100644 index 0000000000000..899130abe27db --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py @@ -0,0 +1,22 @@ +""" +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.FindSubSection("hello_section_name") +    obj.GetNumSubSections() +    obj.GetSubSectionAtIndex(600) +    obj.GetFileAddress() +    obj.GetByteSize() +    obj.GetFileOffset() +    obj.GetFileByteSize() +    obj.GetSectionData(1000, 100) +    obj.GetSectionType() +    obj.GetDescription(lldb.SBStream()) +    for subsec in obj: +        s = str(subsec) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py new file mode 100644 index 0000000000000..9d8242c9b27dc --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py @@ -0,0 +1,17 @@ +""" +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.AppendString("another string") +    obj.AppendString(None) +    obj.AppendList(None, 0) +    obj.AppendList(lldb.SBStringList()) +    obj.GetSize() +    obj.GetStringAtIndex(0xffffffff) +    obj.Clear() +    for n in obj: +        s = str(n) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py new file mode 100644 index 0000000000000..4a4c67a088043 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py @@ -0,0 +1,16 @@ +""" +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.GetName() +    obj.GetMangledName() +    obj.GetInstructions(lldb.SBTarget()) +    obj.GetStartAddress() +    obj.GetEndAddress() +    obj.GetPrologueByteSize() +    obj.GetType() +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py new file mode 100644 index 0000000000000..01b5b7b793ea7 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py @@ -0,0 +1,15 @@ +""" +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.GetModule() +    obj.GetCompileUnit() +    obj.GetFunction() +    obj.GetBlock() +    obj.GetLineEntry() +    obj.GetSymbol() +    obj.GetDescription(lldb.SBStream()) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py new file mode 100644 index 0000000000000..3b01be3e34405 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py @@ -0,0 +1,65 @@ +""" +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.GetProcess() +    listener = lldb.SBListener() +    error = lldb.SBError() +    obj.Launch(listener, None, None, None, None, None, None, 0, True, error) +    obj.LaunchSimple(None, None, None) +    obj.AttachToProcessWithID(listener, 123, error) +    obj.AttachToProcessWithName(listener, 'lldb', False, error) +    obj.ConnectRemote(listener, "connect://to/here", None, error) +    obj.GetExecutable() +    obj.GetNumModules() +    obj.GetModuleAtIndex(0xffffffff) +    obj.GetDebugger() +    filespec = lldb.SBFileSpec() +    obj.FindModule(filespec) +    sc_list = obj.FindFunctions("the_func") +    sc_list = obj.FindFunctions("the_func", lldb.eFunctionNameTypeAny) +    obj.FindFirstType("dont_care") +    obj.FindTypes("dont_care") +    obj.FindFirstType(None) +    obj.GetInstructions(lldb.SBAddress(), bytearray()) +    obj.GetSourceManager() +    obj.FindGlobalVariables("my_global_var", 1) +    address = obj.ResolveLoadAddress(0xffff) +    obj.ResolveSymbolContextForAddress(address, 0) +    obj.BreakpointCreateByLocation("filename", 20) +    obj.BreakpointCreateByLocation(filespec, 20) +    obj.BreakpointCreateByName("func", None) +    obj.BreakpointCreateByRegex("func.", None) +    obj.BreakpointCreateByAddress(0xf0f0) +    obj.GetNumBreakpoints() +    obj.GetBreakpointAtIndex(0) +    obj.BreakpointDelete(0) +    obj.FindBreakpointByID(0) +    obj.EnableAllBreakpoints() +    obj.DisableAllBreakpoints() +    obj.DeleteAllBreakpoints() +    obj.GetNumWatchpoints() +    obj.GetWatchpointAtIndex(0) +    obj.DeleteWatchpoint(0) +    obj.FindWatchpointByID(0) +    obj.EnableAllWatchpoints() +    obj.DisableAllWatchpoints() +    obj.DeleteAllWatchpoints() +    obj.GetAddressByteSize() +    obj.GetByteOrder() +    obj.GetTriple() +    error = lldb.SBError() +    obj.WatchAddress(123, 8, True, True, error) +    obj.GetBroadcaster() +    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief) +    obj.Clear() +    for module in obj.module_iter(): +        s = str(module) +    for bp in obj.breakpoint_iter(): +        s = str(bp) +    for wp in obj.watchpoint_iter(): +        s = str(wp) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py new file mode 100644 index 0000000000000..b69b22ea6a9fc --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py @@ -0,0 +1,37 @@ +""" +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.GetStopReason() +    obj.GetStopReasonDataCount() +    obj.GetStopReasonDataAtIndex(100) +    obj.GetStopDescription(256) +    obj.GetThreadID() +    obj.GetIndexID() +    obj.GetName() +    obj.GetQueueName() +    obj.StepOver(lldb.eOnlyDuringStepping) +    obj.StepInto(lldb.eOnlyDuringStepping) +    obj.StepOut() +    frame = lldb.SBFrame() +    obj.StepOutOfFrame(frame) +    obj.StepInstruction(True) +    filespec = lldb.SBFileSpec() +    obj.StepOverUntil(frame, filespec, 1234) +    obj.RunToAddress(0xabcd) +    obj.Suspend() +    obj.Resume() +    obj.IsSuspended() +    obj.GetNumFrames() +    obj.GetFrameAtIndex(200) +    obj.GetSelectedFrame() +    obj.SetSelectedFrame(999) +    obj.GetProcess() +    obj.GetDescription(lldb.SBStream()) +    obj.Clear() +    for frame in obj: +        s = str(frame) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py new file mode 100644 index 0000000000000..5c801c1fbf2e3 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py @@ -0,0 +1,22 @@ +""" +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.GetName() +    obj.GetByteSize() +    #obj.GetEncoding(5) +    obj.GetNumberChildren(True) +    member = lldb.SBTypeMember() +    obj.GetChildAtIndex(True, 0, member) +    obj.GetChildIndexForName(True, "_member_field") +    obj.IsAPointerType() +    obj.GetPointeeType() +    obj.GetDescription(lldb.SBStream()) +    obj.IsPointerType(None) +    lldb.SBType.IsPointerType(None) +    for child_type in obj: +        s = str(child_type) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py new file mode 100644 index 0000000000000..2bb8c58e25469 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py @@ -0,0 +1,67 @@ +""" +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.GetError() +    obj.GetID() +    obj.GetName() +    obj.GetTypeName() +    obj.GetByteSize() +    obj.IsInScope() +    obj.GetFormat() +    obj.SetFormat(lldb.eFormatBoolean) +    obj.GetValue() +    obj.GetValueType() +    obj.GetValueDidChange() +    obj.GetSummary() +    obj.GetObjectDescription() +    obj.GetLocation() +    obj.SetValueFromCString("my_new_value") +    obj.GetChildAtIndex(1) +    obj.GetChildAtIndex(2, lldb.eNoDynamicValues, False) +    obj.GetIndexOfChildWithName("my_first_child") +    obj.GetChildMemberWithName("my_first_child") +    obj.GetChildMemberWithName("my_first_child", lldb.eNoDynamicValues) +    obj.GetNumChildren() +    obj.GetOpaqueType() +    obj.Dereference() +    obj.TypeIsPointerType() +    stream = lldb.SBStream() +    obj.GetDescription(stream) +    obj.GetExpressionPath(stream) +    obj.GetExpressionPath(stream, True) +    error = lldb.SBError() +    obj.Watch(True, True, False, error) +    obj.WatchPointee(True, False, True, error) +    for child_val in obj: +        s = str(child_val) +    error = lldb.SBError() +    obj.GetValueAsSigned (error, 0) +    obj.GetValueAsUnsigned (error, 0) +    obj.GetValueAsSigned(0) +    obj.GetValueAsUnsigned(0) +    obj.GetDynamicValue (lldb.eNoDynamicValues) +    obj.GetStaticValue () +    obj.IsDynamic() +    invalid_type = lldb.SBType() +    obj.CreateChildAtOffset ("a", 12, invalid_type) +    obj.Cast (invalid_type) +    obj.CreateValueFromExpression ("pt->x", "pt->x") +    obj.CreateValueFromAddress ("x", 0x123, invalid_type) +    invalid_data = lldb.SBData() +    obj.CreateValueFromData ("x", invalid_data, invalid_type) +    obj.GetValueForExpressionPath("[0]") +    obj.AddressOf() +    obj.GetLoadAddress() +    obj.GetAddress() +    obj.GetPointeeData (0, 1) +    obj.GetData () +    obj.GetTarget() +    obj.GetProcess() +    obj.GetThread() +    obj.GetFrame() +    obj.GetType() diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py new file mode 100644 index 0000000000000..32f12f93dd811 --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py @@ -0,0 +1,14 @@ +""" +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.Append(lldb.SBValue()) +    obj.GetSize() +    obj.GetValueAtIndex(100) +    obj.FindValueObjectByUID(200) +    for val in obj: +        s = str(val) diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py new file mode 100644 index 0000000000000..f462e62ff164b --- /dev/null +++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py @@ -0,0 +1,21 @@ +""" +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.GetID() +    obj.IsValid() +    obj.GetHardwareIndex() +    obj.GetWatchAddress() +    obj.GetWatchSize() +    obj.SetEnabled(True) +    obj.IsEnabled() +    obj.GetHitCount() +    obj.GetIgnoreCount() +    obj.SetIgnoreCount(5) +    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose) +    obj.SetCondition("shouldWeStop()") +    obj.GetCondition() | 
