Package lldb :: Class SBError
[hide private]
[frames] | no frames]

Class SBError

source code



Represents a container for holding any error code.

For example (from test/python_api/hello_world/TestHelloWorld.py),

    def hello_world_attach_with_id_api(self):
        '''Create target, spawn a process, and attach to it by id.'''

        target = self.dbg.CreateTarget(self.exe)

        # Spawn a new process and don't display the stdout if not in TraceOn() mode.
        import subprocess
        popen = subprocess.Popen([self.exe, 'abc', 'xyz'],
                                 stdout = open(os.devnull, 'w') if not self.TraceOn() else None)

        listener = lldb.SBListener('my.attach.listener')
        error = lldb.SBError()
        process = target.AttachToProcessWithID(listener, popen.pid, error)

        self.assertTrue(error.Success() and process, PROCESS_IS_VALID)

        # Let's check the stack traces of the attached process.
        import lldbutil
        stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
        self.expect(stacktraces, exe=False,
            substrs = ['main.c:%d' % self.line2,
                       '(int)argc=3'])

        listener = lldb.SBListener('my.attach.listener')
        error = lldb.SBError()
        process = target.AttachToProcessWithID(listener, popen.pid, error)

        self.assertTrue(error.Success() and process, PROCESS_IS_VALID)

checks that after the attach, there is no error condition by asserting
that error.Success() is True and we get back a valid process object.

And (from test/python_api/event/TestEvent.py),

        # Now launch the process, and do not stop at entry point.
        error = lldb.SBError()
        process = target.Launch(listener, None, None, None, None, None, None, 0, False, error)
        self.assertTrue(error.Success() and process, PROCESS_IS_VALID)

checks that after calling the target.Launch() method there's no error
condition and we get back a void process object.

Instance Methods [hide private]
 
__repr__(self) source code
 
__init__(self, *args)
__init__(lldb::SBError self) -> SBError __init__(lldb::SBError self, SBError rhs) -> SBError
source code
 
GetCString(self)
GetCString(SBError self) -> char const *
source code
 
Clear(self)
Clear(SBError self)
source code
 
Fail(self)
Fail(SBError self) -> bool
source code
 
Success(self)
Success(SBError self) -> bool
source code
 
GetError(self)
GetError(SBError self) -> uint32_t
source code
 
GetType(self)
GetType(SBError self) -> lldb::ErrorType
source code
 
SetError(self, *args)
SetError(SBError self, uint32_t err, lldb::ErrorType type)
source code
 
SetErrorToErrno(self)
SetErrorToErrno(SBError self)
source code
 
SetErrorToGenericError(self)
SetErrorToGenericError(SBError self)
source code
 
SetErrorString(self, *args)
SetErrorString(SBError self, char const * err_str)
source code
 
SetErrorStringWithFormat(self, *args)
SetErrorStringWithFormat(SBError self, char const * format, char * str1=None, char * str2=None, char * str3=None) -> int SetErrorStringWithFormat(SBError self, char const * format, char * str1=None, char * str2=None) -> int SetErrorStringWithFormat(SBError self, char const * format, char * str1=None) -> int SetErrorStringWithFormat(SBError self, char const * format) -> int
source code
 
IsValid(self)
IsValid(SBError self) -> bool
source code
 
__nonzero__(self) source code
 
__bool__(self) source code
 
GetDescription(self, *args)
GetDescription(SBError self, SBStream description) -> bool
source code
 
__str__(self)
__str__(SBError self) -> PyObject *
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __setattr__ = lambda self, name, value:
  __swig_getmethods__ = {}
  __getattr__ = lambda self, name:
  __swig_destroy__ = _lldb.delete_SBError
  __del__ = lambda self: