Esempio n. 1
0
def fuzz_obj(obj):
    obj.SetAsync(True)
    obj.SetAsync(False)
    obj.GetAsync()
    obj.SkipLLDBInitFiles(True)
    obj.SetInputFileHandle(None, True)
    obj.SetOutputFileHandle(None, True)
    obj.SetErrorFileHandle(None, True)
    obj.GetInputFileHandle()
    obj.GetOutputFileHandle()
    obj.GetErrorFileHandle()
    obj.GetCommandInterpreter()
    obj.HandleCommand("nothing here")
    listener = obj.GetListener()
    obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
    obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
    obj.CreateTargetWithFileAndArch("b.out", "arm")
    obj.CreateTarget("c.out")
    obj.DeleteTarget(lldb.SBTarget())
    obj.GetTargetAtIndex(0xffffffff)
    obj.FindTargetWithProcessID(0)
    obj.FindTargetWithFileAndArch("a.out", "arm")
    obj.GetNumTargets()
    obj.GetSelectedTarget()
    obj.GetSourceManager()
    obj.SetSelectedTarget(lldb.SBTarget())
    obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
    try:
        obj.DispatchInput(None)
    except Exception:
        pass
    obj.DispatchInputInterrupt()
    obj.DispatchInputEndOfFile()
    obj.PushInputReader(lldb.SBInputReader())
    obj.NotifyTopInputReader(lldb.eInputReaderActivate)
    obj.InputReaderIsTopReader(lldb.SBInputReader())
    obj.GetInstanceName()
    obj.GetDescription(lldb.SBStream())
    obj.GetTerminalWidth()
    obj.SetTerminalWidth(0xffffffff)
    obj.GetID()
    obj.GetPrompt()
    obj.SetPrompt("Hi, Mom!")
    obj.GetScriptLanguage()
    obj.SetScriptLanguage(lldb.eScriptLanguageNone)
    obj.SetScriptLanguage(lldb.eScriptLanguagePython)
    obj.GetCloseInputOnEOF()
    obj.SetCloseInputOnEOF(True)
    obj.SetCloseInputOnEOF(False)
    obj.Clear()
    for target in obj:
        s = str(target)
 def test_SBInputReader(self):
     obj = lldb.SBInputReader()
     if self.TraceOn():
         print obj
     self.assertFalse(obj)
     # Do fuzz testing on the invalid obj, it should not crash lldb.
     import sb_inputreader
     sb_inputreader.fuzz_obj(obj)
Esempio n. 3
0
 def __init__(self, debugger, callback):
   self.debugger = debugger
   self.callback = callback
   self.inputReader = lldb.SBInputReader()
   self.inputReader.Initialize(
                               debugger,
                               self.handleInput,
                               lldb.eInputReaderGranularityLine,
                               None,
                               None, # prompt
                               True # echo
                               )
Esempio n. 4
0
    def input_reader_callback(self, callback):
        """Test the SBInputReader callbacks."""
        self.succeeded = False

        input_reader = lldb.SBInputReader()
        input_reader.Initialize(self.dbg, callback,
                                lldb.eInputReaderGranularityByte, "$", "^",
                                False)

        self.dbg.PushInputReader(input_reader)
        self.dbg.DispatchInput("Hello!$")
        self.assertFalse(self.dbg.InputReaderIsTopReader(input_reader))
        self.assertTrue(self.succeeded)