sb_target.py revision cd186e5ef6dacca7bd4914e99ef6b7551b5e79e4
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 contextlist = lldb.SBSymbolContextList() 24 obj.FindFunctions("the_func", 0xff, True, contextlist) 25 obj.FindFirstType("dont_care") 26 obj.FindTypes("dont_care") 27 obj.FindFirstType(None) 28 obj.GetSourceManager() 29 obj.FindGlobalVariables("my_global_var", 1) 30 address = obj.ResolveLoadAddress(0xffff) 31 obj.ResolveSymbolContextForAddress(address, 0) 32 obj.BreakpointCreateByLocation("filename", 20) 33 obj.BreakpointCreateByLocation(filespec, 20) 34 obj.BreakpointCreateByName("func", None) 35 obj.BreakpointCreateByRegex("func.", None) 36 obj.BreakpointCreateByAddress(0xf0f0) 37 obj.GetNumBreakpoints() 38 obj.GetBreakpointAtIndex(0) 39 obj.BreakpointDelete(0) 40 obj.FindBreakpointByID(0) 41 obj.EnableAllBreakpoints() 42 obj.DisableAllBreakpoints() 43 obj.DeleteAllBreakpoints() 44 obj.GetNumWatchpoints() 45 obj.GetWatchpointAtIndex(0) 46 obj.DeleteWatchpoint(0) 47 obj.FindWatchpointByID(0) 48 obj.EnableAllWatchpoints() 49 obj.DisableAllWatchpoints() 50 obj.DeleteAllWatchpoints() 51 obj.WatchAddress(123, 8, True, True) 52 obj.GetBroadcaster() 53 obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief) 54 obj.Clear() 55 for module in obj.module_iter(): 56 print module 57 for bp in obj.breakpoint_iter(): 58 print bp 59 for wp in obj.watchpoint_iter(): 60 print wp 61