• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- SWIG Interface for SBSourceManager ----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 namespace lldb {
10 
11 %feature("docstring",
12 "Represents a central authority for displaying source code.
13 
14 For example (from test/source-manager/TestSourceManager.py),
15 
16         # Create the filespec for 'main.c'.
17         filespec = lldb.SBFileSpec('main.c', False)
18         source_mgr = self.dbg.GetSourceManager()
19         # Use a string stream as the destination.
20         stream = lldb.SBStream()
21         source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
22                                                      self.line,
23                                                      2, # context before
24                                                      2, # context after
25                                                      '=>', # prefix for current line
26                                                      stream)
27 
28         #    2
29         #    3    int main(int argc, char const *argv[]) {
30         # => 4        printf('Hello world.\\n'); // Set break point at this line.
31         #    5        return 0;
32         #    6    }
33         self.expect(stream.GetData(), 'Source code displayed correctly',
34                     exe=False,
35             patterns = ['=> %d.*Hello world' % self.line])") SBSourceManager;
36 class SBSourceManager
37 {
38 public:
39     SBSourceManager (const lldb::SBSourceManager &rhs);
40 
41     ~SBSourceManager();
42 
43     size_t
44     DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
45                                        uint32_t line,
46                                        uint32_t context_before,
47                                        uint32_t context_after,
48                                        const char* current_line_cstr,
49                                        lldb::SBStream &s);
50     size_t
51     DisplaySourceLinesWithLineNumbersAndColumn (const lldb::SBFileSpec &file,
52                                                 uint32_t line, uint32_t column,
53                                                 uint32_t context_before,
54                                                 uint32_t context_after,
55                                                 const char* current_line_cstr,
56                                                 lldb::SBStream &s);
57 };
58 
59 } // namespace lldb
60