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.GetProcess()
10    listener = lldb.SBListener()
11    error = lldb.SBError()
12    obj.Launch(listener, None, None, None, None, None, None, 0, True, error)
13    obj.LaunchSimple(None, None, None)
14    obj.AttachToProcessWithID(listener, 123, error)
15    obj.AttachToProcessWithName(listener, 'lldb', False, error)
16    obj.ConnectRemote(listener, "connect://to/here", None, error)
17    obj.GetExecutable()
18    obj.GetNumModules()
19    obj.GetModuleAtIndex(0xffffffff)
20    obj.GetDebugger()
21    filespec = lldb.SBFileSpec()
22    obj.FindModule(filespec)
23    sc_list = obj.FindFunctions("the_func")
24    sc_list = obj.FindFunctions("the_func", lldb.eFunctionNameTypeAny)
25    obj.FindFirstType("dont_care")
26    obj.FindTypes("dont_care")
27    obj.FindFirstType(None)
28    obj.GetInstructions(lldb.SBAddress(), bytearray())
29    obj.GetSourceManager()
30    obj.FindGlobalVariables("my_global_var", 1)
31    address = obj.ResolveLoadAddress(0xffff)
32    obj.ResolveSymbolContextForAddress(address, 0)
33    obj.BreakpointCreateByLocation("filename", 20)
34    obj.BreakpointCreateByLocation(filespec, 20)
35    obj.BreakpointCreateByName("func", None)
36    obj.BreakpointCreateByRegex("func.", None)
37    obj.BreakpointCreateByAddress(0xf0f0)
38    obj.GetNumBreakpoints()
39    obj.GetBreakpointAtIndex(0)
40    obj.BreakpointDelete(0)
41    obj.FindBreakpointByID(0)
42    obj.EnableAllBreakpoints()
43    obj.DisableAllBreakpoints()
44    obj.DeleteAllBreakpoints()
45    obj.GetNumWatchpoints()
46    obj.GetWatchpointAtIndex(0)
47    obj.DeleteWatchpoint(0)
48    obj.FindWatchpointByID(0)
49    obj.EnableAllWatchpoints()
50    obj.DisableAllWatchpoints()
51    obj.DeleteAllWatchpoints()
52    obj.GetAddressByteSize()
53    obj.GetByteOrder()
54    obj.GetTriple()
55    error = lldb.SBError()
56    obj.WatchAddress(123, 8, True, True, error)
57    obj.GetBroadcaster()
58    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
59    obj.Clear()
60    for module in obj.module_iter():
61        print module
62    for bp in obj.breakpoint_iter():
63        print bp
64    for wp in obj.watchpoint_iter():
65        print wp
66