brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 1acf102 Raw
69 lines · python
1"""2Fuzz tests an object after the default construction to make sure it does not crash lldb.3"""4 5import lldb6 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    wp_opts = lldb.SBWatchpointOptions()57    wp_opts.SetWatchpointTypeRead(True)58    wp_opts.SetWatchpointTypeWrite(lldb.eWatchpointWriteTypeOnModify)59    obj.WatchpointCreateByAddress(123, 8, wp_opts, error)60    obj.GetBroadcaster()61    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)62    obj.Clear()63    for module in obj.module_iter():64        s = str(module)65    for bp in obj.breakpoint_iter():66        s = str(bp)67    for wp in obj.watchpoint_iter():68        s = str(wp)69