sb_target.py revision 61369695d149f07aeb3a06dfc93789b773b206f8
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.GetSourceManager()
28    obj.FindGlobalVariables("my_global_var", 1)
29    address = obj.ResolveLoadAddress(0xffff)
30    obj.ResolveSymbolContextForAddress(address, 0)
31    obj.BreakpointCreateByLocation("filename", 20)
32    obj.BreakpointCreateByLocation(filespec, 20)
33    obj.BreakpointCreateByName("func", None)
34    obj.BreakpointCreateByRegex("func.", None)
35    obj.BreakpointCreateByAddress(0xf0f0)
36    obj.GetNumBreakpoints()
37    obj.GetBreakpointAtIndex(0)
38    obj.BreakpointDelete(0)
39    obj.FindBreakpointByID(0)
40    obj.EnableAllBreakpoints()
41    obj.DisableAllBreakpoints()
42    obj.DeleteAllBreakpoints()
43    obj.GetNumWatchpointLocations()
44    obj.GetLastCreatedWatchpointLocation()
45    obj.GetWatchpointLocationAtIndex(0)
46    obj.WatchpointLocationDelete(0)
47    obj.FindWatchpointLocationByID(0)
48    obj.EnableAllWatchpointLocations()
49    obj.DisableAllWatchpointLocations()
50    obj.DeleteAllWatchpointLocations()
51    obj.GetBroadcaster()
52    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
53    obj.Clear()
54    for module in obj.module_iter():
55        print module
56    for bp in obj.breakpoint_iter():
57        print bp
58    for wp_loc in obj.watchpoint_location_iter():
59        print wp_loc
60