2011-07-20 06:41:47 +08:00
|
|
|
//===-- SWIG Interface for SBSourceManager ----------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace lldb {
|
|
|
|
|
2011-07-20 07:35:10 +08:00
|
|
|
%feature("docstring",
|
|
|
|
"Represents a central authority for displaying source code.
|
|
|
|
|
|
|
|
For example (from test/source-manager/TestSourceManager.py),
|
|
|
|
|
|
|
|
# Create the filespec for 'main.c'.
|
|
|
|
filespec = lldb.SBFileSpec('main.c', False)
|
|
|
|
source_mgr = self.dbg.GetSourceManager()
|
|
|
|
# Use a string stream as the destination.
|
|
|
|
stream = lldb.SBStream()
|
|
|
|
source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
|
|
|
|
self.line,
|
|
|
|
2, # context before
|
|
|
|
2, # context after
|
|
|
|
'=>', # prefix for current line
|
|
|
|
stream)
|
|
|
|
|
|
|
|
# 2
|
|
|
|
# 3 int main(int argc, char const *argv[]) {
|
|
|
|
# => 4 printf('Hello world.\\n'); // Set break point at this line.
|
|
|
|
# 5 return 0;
|
|
|
|
# 6 }
|
|
|
|
self.expect(stream.GetData(), 'Source code displayed correctly',
|
|
|
|
exe=False,
|
|
|
|
patterns = ['=> %d.*Hello world' % self.line])
|
|
|
|
") SBSourceManager;
|
2011-07-20 06:41:47 +08:00
|
|
|
class SBSourceManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SBSourceManager (const lldb::SBSourceManager &rhs);
|
|
|
|
|
|
|
|
~SBSourceManager();
|
|
|
|
|
|
|
|
size_t
|
|
|
|
DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
|
|
|
|
uint32_t line,
|
|
|
|
uint32_t context_before,
|
|
|
|
uint32_t context_after,
|
|
|
|
const char* current_line_cstr,
|
|
|
|
lldb::SBStream &s);
|
add stop column highlighting support
This change introduces optional marking of the column within a source
line where a thread is stopped. This marking will show up when the
source code for a thread stop is displayed, when the debug info
knows the column information, and if the optional column marking is
enabled.
There are two separate methods for handling the marking of the stop
column:
* via ANSI terminal codes, which are added inline to the source line
display. The default ANSI mark-up is to underline the column.
* via a pure text-based caret that is added in the appropriate column
in a newly-inserted blank line underneath the source line in
question.
There are some new options that control how this all works.
* settings set stop-show-column
This takes one of 4 values:
* ansi-or-caret: use the ANSI terminal code mechanism if LLDB
is running with color enabled; if not, use the caret-based,
pure text method (see the "caret" mode below).
* ansi: only use the ANSI terminal code mechanism to highlight
the stop line. If LLDB is running with color disabled, no
stop column marking will occur.
* caret: only use the pure text caret method, which introduces
a newly-inserted line underneath the current line, where
the only character in the new line is a caret that highlights
the stop column in question.
* none: no stop column marking will be attempted.
* settings set stop-show-column-ansi-prefix
This is a text format that indicates the ANSI formatting
code to insert into the stream immediately preceding the
column where the stop column character will be marked up.
It defaults to ${ansi.underline}; however, it can contain
any valid LLDB format codes, e.g.
${ansi.fg.red}${ansi.bold}${ansi.underline}
* settings set stop-show-column-ansi-suffix
This is the text format that specifies the ANSI terminal
codes to end the markup that was started with the prefix
described above. It defaults to: ${ansi.normal}. This
should be sufficient for the common cases.
Significant leg-work was done by Adrian Prantl. (Thanks, Adrian!)
differential review: https://reviews.llvm.org/D20835
reviewers: clayborg, jingham
llvm-svn: 282105
2016-09-22 04:13:14 +08:00
|
|
|
size_t
|
|
|
|
DisplaySourceLinesWithLineNumbersAndColumn (const lldb::SBFileSpec &file,
|
|
|
|
uint32_t line, uint32_t column,
|
|
|
|
uint32_t context_before,
|
|
|
|
uint32_t context_after,
|
|
|
|
const char* current_line_cstr,
|
|
|
|
lldb::SBStream &s);
|
2011-07-20 06:41:47 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace lldb
|