summaryrefslogtreecommitdiff
path: root/lldb/bindings/interface/SBSourceManagerDocstrings.i
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-01-26 17:33:33 -0800
committerAlex Langford <alangford@apple.com>2023-02-16 11:18:04 -0800
commit662548c82683bd8657a3179afee693c4965a3dfd (patch)
treef1d6df4e4ed17672c186e0d5df551bc5916e8d10 /lldb/bindings/interface/SBSourceManagerDocstrings.i
parent23d43e6977576ed318a9c81cec256d75f5d49ded (diff)
[lldb] Replace SB swig interfaces with API headers
Instead of maintaining separate swig interface files, we can use the API headers directly. They implement the exact same C++ APIs and we can conditionally include the python extensions as needed. To remove the swig extensions from the API headers when building the LLDB framework, we can use the unifdef tool when it is available. Otherwise we just copy them as-is. Differential Revision: https://reviews.llvm.org/D142926
Diffstat (limited to 'lldb/bindings/interface/SBSourceManagerDocstrings.i')
-rw-r--r--lldb/bindings/interface/SBSourceManagerDocstrings.i26
1 files changed, 26 insertions, 0 deletions
diff --git a/lldb/bindings/interface/SBSourceManagerDocstrings.i b/lldb/bindings/interface/SBSourceManagerDocstrings.i
new file mode 100644
index 000000000000..0f089941787f
--- /dev/null
+++ b/lldb/bindings/interface/SBSourceManagerDocstrings.i
@@ -0,0 +1,26 @@
+%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])"
+) lldb::SBSourceManager;