blob: 09cd449149d9fd21a6cb222a260709c0a4645cea [file] [log] [blame]
Johnny Chen5cb6cab2011-07-19 22:41:47 +00001//===-- SWIG Interface for SBSourceManager ----------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10namespace lldb {
11
Johnny Chen8a470282011-07-19 23:35:10 +000012%feature("docstring",
13"Represents a central authority for displaying source code.
14
15For example (from test/source-manager/TestSourceManager.py),
16
17 # Create the filespec for 'main.c'.
18 filespec = lldb.SBFileSpec('main.c', False)
19 source_mgr = self.dbg.GetSourceManager()
20 # Use a string stream as the destination.
21 stream = lldb.SBStream()
22 source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
23 self.line,
24 2, # context before
25 2, # context after
26 '=>', # prefix for current line
27 stream)
28
29 # 2
30 # 3 int main(int argc, char const *argv[]) {
31 # => 4 printf('Hello world.\\n'); // Set break point at this line.
32 # 5 return 0;
33 # 6 }
34 self.expect(stream.GetData(), 'Source code displayed correctly',
35 exe=False,
36 patterns = ['=> %d.*Hello world' % self.line])
37") SBSourceManager;
Johnny Chen5cb6cab2011-07-19 22:41:47 +000038class SBSourceManager
39{
40public:
41 SBSourceManager (const lldb::SBSourceManager &rhs);
42
43 ~SBSourceManager();
44
45 size_t
46 DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
47 uint32_t line,
48 uint32_t context_before,
49 uint32_t context_after,
50 const char* current_line_cstr,
51 lldb::SBStream &s);
52};
53
54} // namespace lldb