xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBStreamDocstrings.i (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric %feature("docstring",
2*06c3fb27SDimitry Andric "Represents a destination for streaming data output to. By default, a string
3*06c3fb27SDimitry Andric stream is created.
4*06c3fb27SDimitry Andric 
5*06c3fb27SDimitry Andric For example (from test/source-manager/TestSourceManager.py), ::
6*06c3fb27SDimitry Andric 
7*06c3fb27SDimitry Andric         # Create the filespec for 'main.c'.
8*06c3fb27SDimitry Andric         filespec = lldb.SBFileSpec('main.c', False)
9*06c3fb27SDimitry Andric         source_mgr = self.dbg.GetSourceManager()
10*06c3fb27SDimitry Andric         # Use a string stream as the destination.
11*06c3fb27SDimitry Andric         stream = lldb.SBStream()
12*06c3fb27SDimitry Andric         source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
13*06c3fb27SDimitry Andric                                                      self.line,
14*06c3fb27SDimitry Andric                                                      2, # context before
15*06c3fb27SDimitry Andric                                                      2, # context after
16*06c3fb27SDimitry Andric                                                      '=>', # prefix for current line
17*06c3fb27SDimitry Andric                                                      stream)
18*06c3fb27SDimitry Andric 
19*06c3fb27SDimitry Andric         #    2
20*06c3fb27SDimitry Andric         #    3    int main(int argc, char const *argv[]) {
21*06c3fb27SDimitry Andric         # => 4        printf('Hello world.\\n'); // Set break point at this line.
22*06c3fb27SDimitry Andric         #    5        return 0;
23*06c3fb27SDimitry Andric         #    6    }
24*06c3fb27SDimitry Andric         self.expect(stream.GetData(), 'Source code displayed correctly',
25*06c3fb27SDimitry Andric                     exe=False,
26*06c3fb27SDimitry Andric             patterns = ['=> %d.*Hello world' % self.line])"
27*06c3fb27SDimitry Andric ) lldb::SBStream;
28*06c3fb27SDimitry Andric 
29*06c3fb27SDimitry Andric %feature("docstring", "
30*06c3fb27SDimitry Andric     If this stream is not redirected to a file, it will maintain a local
31*06c3fb27SDimitry Andric     cache for the stream data which can be accessed using this accessor."
32*06c3fb27SDimitry Andric ) lldb::SBStream::GetData;
33*06c3fb27SDimitry Andric 
34*06c3fb27SDimitry Andric %feature("docstring", "
35*06c3fb27SDimitry Andric     If this stream is not redirected to a file, it will maintain a local
36*06c3fb27SDimitry Andric     cache for the stream output whose length can be accessed using this
37*06c3fb27SDimitry Andric     accessor."
38*06c3fb27SDimitry Andric ) lldb::SBStream::GetSize;
39*06c3fb27SDimitry Andric 
40*06c3fb27SDimitry Andric %feature("docstring", "
41*06c3fb27SDimitry Andric     If the stream is redirected to a file, forget about the file and if
42*06c3fb27SDimitry Andric     ownership of the file was transferred to this object, close the file.
43*06c3fb27SDimitry Andric     If the stream is backed by a local cache, clear this cache."
44*06c3fb27SDimitry Andric ) lldb::SBStream::Clear;
45