143fc089c932931492c73d2a02cea65958d498deeJohnny Chen"""
243fc089c932931492c73d2a02cea65958d498deeJohnny ChenFuzz tests an object after the default construction to make sure it does not crash lldb.
343fc089c932931492c73d2a02cea65958d498deeJohnny Chen"""
443fc089c932931492c73d2a02cea65958d498deeJohnny Chen
543fc089c932931492c73d2a02cea65958d498deeJohnny Chenimport sys
643fc089c932931492c73d2a02cea65958d498deeJohnny Chenimport lldb
743fc089c932931492c73d2a02cea65958d498deeJohnny Chen
843fc089c932931492c73d2a02cea65958d498deeJohnny Chendef fuzz_obj(obj):
943fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetAsync(True)
1043fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetAsync(False)
1112a8ecd6c9b2651e0913930047a0e5791e8fd334Johnny Chen    obj.GetAsync()
1243fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SkipLLDBInitFiles(True)
1343fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetInputFileHandle(None, True)
1443fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetOutputFileHandle(None, True)
1543fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetErrorFileHandle(None, True)
1643fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetInputFileHandle()
1743fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetOutputFileHandle()
1843fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetErrorFileHandle()
1943fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetCommandInterpreter()
2043fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.HandleCommand("nothing here")
2143fc089c932931492c73d2a02cea65958d498deeJohnny Chen    listener = obj.GetListener()
2243fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
2343fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
2443fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.CreateTargetWithFileAndArch("b.out", "arm")
2543fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.CreateTarget("c.out")
2643fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.DeleteTarget(lldb.SBTarget())
2743fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetTargetAtIndex(0xffffffff)
2843fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.FindTargetWithProcessID(0)
2943fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.FindTargetWithFileAndArch("a.out", "arm")
3043fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetNumTargets()
3143fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetSelectedTarget()
3243fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetSourceManager()
3312a8ecd6c9b2651e0913930047a0e5791e8fd334Johnny Chen    obj.SetSelectedTarget(lldb.SBTarget())
3443fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
3516742a69d9f33a168d91d992a2844279366bcf90Johnny Chen    try:
3616742a69d9f33a168d91d992a2844279366bcf90Johnny Chen        obj.DispatchInput(None)
3716742a69d9f33a168d91d992a2844279366bcf90Johnny Chen    except Exception:
3816742a69d9f33a168d91d992a2844279366bcf90Johnny Chen        pass
3943fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.DispatchInputInterrupt()
4043fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.DispatchInputEndOfFile()
4143fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.PushInputReader(lldb.SBInputReader())
4243fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.NotifyTopInputReader(lldb.eInputReaderActivate)
4343fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.InputReaderIsTopReader(lldb.SBInputReader())
4443fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetInstanceName()
4543fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetDescription(lldb.SBStream())
4643fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetTerminalWidth()
4743fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetTerminalWidth(0xffffffff)
4843fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetID()
4943fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetPrompt()
5043fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetPrompt("Hi, Mom!")
5143fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetScriptLanguage()
5243fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetScriptLanguage(lldb.eScriptLanguageNone)
5343fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetScriptLanguage(lldb.eScriptLanguagePython)
5443fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.GetCloseInputOnEOF()
5543fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetCloseInputOnEOF(True)
5643fc089c932931492c73d2a02cea65958d498deeJohnny Chen    obj.SetCloseInputOnEOF(False)
572287366b1427dcafd8b45e6c2de939d70eaebbd3Johnny Chen    obj.Clear()
58a70c157b98bc6e9c8d1853e54473c3bd5a349a77Johnny Chen    for target in obj:
59a70c157b98bc6e9c8d1853e54473c3bd5a349a77Johnny Chen        print target
60