49 lines · plain
1%feature("docstring",2"Represents a container for holding any error code.3 4For example (from test/python_api/hello_world/TestHelloWorld.py), ::5 6 def hello_world_attach_with_id_api(self):7 '''Create target, spawn a process, and attach to it by id.'''8 9 target = self.dbg.CreateTarget(self.exe)10 11 # Spawn a new process and don't display the stdout if not in TraceOn() mode.12 import subprocess13 popen = subprocess.Popen(14 [self.exe, 'abc', 'xyz'],15 stdout=subprocess.DEVNULL if not self.TraceOn() else None,16 )17 18 listener = lldb.SBListener('my.attach.listener')19 error = lldb.SBError()20 process = target.AttachToProcessWithID(listener, popen.pid, error)21 22 self.assertTrue(error.Success() and process, PROCESS_IS_VALID)23 24 # Let's check the stack traces of the attached process.25 import lldbutil26 stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)27 self.expect(stacktraces, exe=False,28 substrs = ['main.c:%d' % self.line2,29 '(int)argc=3'])30 31 listener = lldb.SBListener('my.attach.listener')32 error = lldb.SBError()33 process = target.AttachToProcessWithID(listener, popen.pid, error)34 35 self.assertTrue(error.Success() and process, PROCESS_IS_VALID)36 37checks that after the attach, there is no error condition by asserting38that error.Success() is True and we get back a valid process object.39 40And (from test/python_api/event/TestEvent.py), ::41 42 # Now launch the process, and do not stop at entry point.43 error = lldb.SBError()44 process = target.Launch(listener, None, None, None, None, None, None, 0, False, error)45 self.assertTrue(error.Success() and process, PROCESS_IS_VALID)46 47checks that after calling the target.Launch() method there's no error48condition and we get back a void process object.") lldb::SBError;49