xref: /freebsd/contrib/llvm-project/lldb/bindings/interface/SBSourceManagerDocstrings.i (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric %feature("docstring",
2*06c3fb27SDimitry Andric "Represents a central authority for displaying source code.
3*06c3fb27SDimitry Andric 
4*06c3fb27SDimitry Andric For example (from test/source-manager/TestSourceManager.py), ::
5*06c3fb27SDimitry Andric 
6*06c3fb27SDimitry Andric         # Create the filespec for 'main.c'.
7*06c3fb27SDimitry Andric         filespec = lldb.SBFileSpec('main.c', False)
8*06c3fb27SDimitry Andric         source_mgr = self.dbg.GetSourceManager()
9*06c3fb27SDimitry Andric         # Use a string stream as the destination.
10*06c3fb27SDimitry Andric         stream = lldb.SBStream()
11*06c3fb27SDimitry Andric         source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
12*06c3fb27SDimitry Andric                                                      self.line,
13*06c3fb27SDimitry Andric                                                      2, # context before
14*06c3fb27SDimitry Andric                                                      2, # context after
15*06c3fb27SDimitry Andric                                                      '=>', # prefix for current line
16*06c3fb27SDimitry Andric                                                      stream)
17*06c3fb27SDimitry Andric 
18*06c3fb27SDimitry Andric         #    2
19*06c3fb27SDimitry Andric         #    3    int main(int argc, char const *argv[]) {
20*06c3fb27SDimitry Andric         # => 4        printf('Hello world.\\n'); // Set break point at this line.
21*06c3fb27SDimitry Andric         #    5        return 0;
22*06c3fb27SDimitry Andric         #    6    }
23*06c3fb27SDimitry Andric         self.expect(stream.GetData(), 'Source code displayed correctly',
24*06c3fb27SDimitry Andric                     exe=False,
25*06c3fb27SDimitry Andric             patterns = ['=> %d.*Hello world' % self.line])"
26*06c3fb27SDimitry Andric ) lldb::SBSourceManager;
27