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