xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBErrorDocstrings.i (revision c57c26179033f64c2011a2d2a904ee3fa62e826a)
1 %feature("docstring",
2 "Represents a container for holding any error code.
3 
4 For 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 subprocess
13         popen = subprocess.Popen([self.exe, 'abc', 'xyz'],
14                                  stdout = open(os.devnull, 'w') if not self.TraceOn() else None)
15 
16         listener = lldb.SBListener('my.attach.listener')
17         error = lldb.SBError()
18         process = target.AttachToProcessWithID(listener, popen.pid, error)
19 
20         self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
21 
22         # Let's check the stack traces of the attached process.
23         import lldbutil
24         stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
25         self.expect(stacktraces, exe=False,
26             substrs = ['main.c:%d' % self.line2,
27                        '(int)argc=3'])
28 
29         listener = lldb.SBListener('my.attach.listener')
30         error = lldb.SBError()
31         process = target.AttachToProcessWithID(listener, popen.pid, error)
32 
33         self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
34 
35 checks that after the attach, there is no error condition by asserting
36 that error.Success() is True and we get back a valid process object.
37 
38 And (from test/python_api/event/TestEvent.py), ::
39 
40         # Now launch the process, and do not stop at entry point.
41         error = lldb.SBError()
42         process = target.Launch(listener, None, None, None, None, None, None, 0, False, error)
43         self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
44 
45 checks that after calling the target.Launch() method there's no error
46 condition and we get back a void process object.") lldb::SBError;
47