1"""
2Fuzz tests an object after the default construction to make sure it does not crash lldb.
3"""
4
5import lldb
6
7
8def fuzz_obj(obj):
9    obj.GetTarget()
10    obj.GetByteOrder()
11    obj.PutSTDIN("my data")
12    obj.GetSTDOUT(6)
13    obj.GetSTDERR(6)
14    event = lldb.SBEvent()
15    try:
16        obj.ReportEventState(event, None)
17    except Exception:
18        pass
19    obj.AppendEventStateReport(event, lldb.SBCommandReturnObject())
20    error = lldb.SBError()
21    obj.RemoteAttachToProcessWithID(123, error)
22    obj.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
23    obj.GetNumThreads()
24    obj.GetThreadAtIndex(0)
25    obj.GetThreadByID(0)
26    obj.GetSelectedThread()
27    obj.SetSelectedThread(lldb.SBThread())
28    obj.SetSelectedThreadByID(0)
29    obj.GetState()
30    obj.GetExitStatus()
31    obj.GetExitDescription()
32    obj.GetProcessID()
33    obj.GetAddressByteSize()
34    obj.Destroy()
35    obj.Continue()
36    obj.Stop()
37    obj.Kill()
38    obj.Detach()
39    obj.Signal(7)
40    obj.ReadMemory(0x0000ffff, 10, error)
41    obj.WriteMemory(0x0000ffff, "hi data", error)
42    obj.ReadCStringFromMemory(0x0, 128, error)
43    obj.ReadUnsignedFromMemory(0xff, 4, error)
44    obj.ReadPointerFromMemory(0xff, error)
45    obj.GetBroadcaster()
46    obj.GetDescription(lldb.SBStream())
47    obj.LoadImage(lldb.SBFileSpec(), error)
48    obj.UnloadImage(0)
49    obj.Clear()
50    obj.GetNumSupportedHardwareWatchpoints(error)
51    for thread in obj:
52        s = str(thread)
53    len(obj)
54