• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Fuzz tests an object after the default construction to make sure it does not crash lldb.
3"""
4
5import sys
6import lldb
7
8def fuzz_obj(obj):
9    obj.SetAsync(True)
10    obj.SetAsync(False)
11    obj.GetAsync()
12    obj.SkipLLDBInitFiles(True)
13    obj.SetInputFileHandle(None, True)
14    obj.SetOutputFileHandle(None, True)
15    obj.SetErrorFileHandle(None, True)
16    obj.GetInputFileHandle()
17    obj.GetOutputFileHandle()
18    obj.GetErrorFileHandle()
19    obj.GetCommandInterpreter()
20    obj.HandleCommand("nothing here")
21    listener = obj.GetListener()
22    obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
23    obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
24    obj.CreateTargetWithFileAndArch("b.out", "arm")
25    obj.CreateTarget("c.out")
26    obj.DeleteTarget(lldb.SBTarget())
27    obj.GetTargetAtIndex(0xffffffff)
28    obj.FindTargetWithProcessID(0)
29    obj.FindTargetWithFileAndArch("a.out", "arm")
30    obj.GetNumTargets()
31    obj.GetSelectedTarget()
32    obj.GetSourceManager()
33    obj.SetSelectedTarget(lldb.SBTarget())
34    obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
35    try:
36        obj.DispatchInput(None)
37    except Exception:
38        pass
39    obj.DispatchInputInterrupt()
40    obj.DispatchInputEndOfFile()
41    obj.PushInputReader(lldb.SBInputReader())
42    obj.NotifyTopInputReader(lldb.eInputReaderActivate)
43    obj.InputReaderIsTopReader(lldb.SBInputReader())
44    obj.GetInstanceName()
45    obj.GetDescription(lldb.SBStream())
46    obj.GetTerminalWidth()
47    obj.SetTerminalWidth(0xffffffff)
48    obj.GetID()
49    obj.GetPrompt()
50    obj.SetPrompt("Hi, Mom!")
51    obj.GetScriptLanguage()
52    obj.SetScriptLanguage(lldb.eScriptLanguageNone)
53    obj.SetScriptLanguage(lldb.eScriptLanguagePython)
54    obj.GetCloseInputOnEOF()
55    obj.SetCloseInputOnEOF(True)
56    obj.SetCloseInputOnEOF(False)
57    obj.Clear()
58    for target in obj:
59        print target
60