File: sb_target.py

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (65 lines) | stat: -rw-r--r-- 2,204 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""

import lldb


def fuzz_obj(obj):
    obj.GetProcess()
    listener = lldb.SBListener()
    error = lldb.SBError()
    obj.Launch(listener, None, None, None, None, None, None, 0, True, error)
    obj.LaunchSimple(None, None, None)
    obj.AttachToProcessWithID(listener, 123, error)
    obj.AttachToProcessWithName(listener, 'lldb', False, error)
    obj.ConnectRemote(listener, "connect://to/here", None, error)
    obj.GetExecutable()
    obj.GetNumModules()
    obj.GetModuleAtIndex(0xffffffff)
    obj.GetDebugger()
    filespec = lldb.SBFileSpec()
    obj.FindModule(filespec)
    sc_list = obj.FindFunctions("the_func")
    sc_list = obj.FindFunctions("the_func", lldb.eFunctionNameTypeAny)
    obj.FindFirstType("dont_care")
    obj.FindTypes("dont_care")
    obj.FindFirstType(None)
    obj.GetInstructions(lldb.SBAddress(), bytearray())
    obj.GetSourceManager()
    obj.FindGlobalVariables("my_global_var", 1)
    address = obj.ResolveLoadAddress(0xffff)
    obj.ResolveSymbolContextForAddress(address, 0)
    obj.BreakpointCreateByLocation("filename", 20)
    obj.BreakpointCreateByLocation(filespec, 20)
    obj.BreakpointCreateByName("func", None)
    obj.BreakpointCreateByRegex("func.", None)
    obj.BreakpointCreateByAddress(0xf0f0)
    obj.GetNumBreakpoints()
    obj.GetBreakpointAtIndex(0)
    obj.BreakpointDelete(0)
    obj.FindBreakpointByID(0)
    obj.EnableAllBreakpoints()
    obj.DisableAllBreakpoints()
    obj.DeleteAllBreakpoints()
    obj.GetNumWatchpoints()
    obj.GetWatchpointAtIndex(0)
    obj.DeleteWatchpoint(0)
    obj.FindWatchpointByID(0)
    obj.EnableAllWatchpoints()
    obj.DisableAllWatchpoints()
    obj.DeleteAllWatchpoints()
    obj.GetAddressByteSize()
    obj.GetByteOrder()
    obj.GetTriple()
    error = lldb.SBError()
    obj.WatchAddress(123, 8, True, True, error)
    obj.GetBroadcaster()
    obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief)
    obj.Clear()
    for module in obj.module_iter():
        s = str(module)
    for bp in obj.breakpoint_iter():
        s = str(bp)
    for wp in obj.watchpoint_iter():
        s = str(wp)