xref: /freebsd-src/contrib/llvm-project/lldb/bindings/interface/SBDebuggerExtensions.i (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1*06c3fb27SDimitry Andric STRING_EXTENSION_OUTSIDE(SBDebugger)
2*06c3fb27SDimitry Andric 
3*06c3fb27SDimitry Andric %extend lldb::SBDebugger {
4*06c3fb27SDimitry Andric #ifdef SWIGPYTHON
5*06c3fb27SDimitry Andric     %pythoncode %{
6*06c3fb27SDimitry Andric         def SetOutputFileHandle(self, file, transfer_ownership):
7*06c3fb27SDimitry Andric             "DEPRECATED, use SetOutputFile"
8*06c3fb27SDimitry Andric             if file is None:
9*06c3fb27SDimitry Andric                 import sys
10*06c3fb27SDimitry Andric                 file = sys.stdout
11*06c3fb27SDimitry Andric             self.SetOutputFile(SBFile.Create(file, borrow=True))
12*06c3fb27SDimitry Andric 
13*06c3fb27SDimitry Andric         def SetInputFileHandle(self, file, transfer_ownership):
14*06c3fb27SDimitry Andric             "DEPRECATED, use SetInputFile"
15*06c3fb27SDimitry Andric             if file is None:
16*06c3fb27SDimitry Andric                 import sys
17*06c3fb27SDimitry Andric                 file = sys.stdin
18*06c3fb27SDimitry Andric             self.SetInputFile(SBFile.Create(file, borrow=True))
19*06c3fb27SDimitry Andric 
20*06c3fb27SDimitry Andric         def SetErrorFileHandle(self, file, transfer_ownership):
21*06c3fb27SDimitry Andric             "DEPRECATED, use SetErrorFile"
22*06c3fb27SDimitry Andric             if file is None:
23*06c3fb27SDimitry Andric                 import sys
24*06c3fb27SDimitry Andric                 file = sys.stderr
25*06c3fb27SDimitry Andric             self.SetErrorFile(SBFile.Create(file, borrow=True))
26*06c3fb27SDimitry Andric 
27*06c3fb27SDimitry Andric         def __iter__(self):
28*06c3fb27SDimitry Andric             '''Iterate over all targets in a lldb.SBDebugger object.'''
29*06c3fb27SDimitry Andric             return lldb_iter(self, 'GetNumTargets', 'GetTargetAtIndex')
30*06c3fb27SDimitry Andric 
31*06c3fb27SDimitry Andric         def __len__(self):
32*06c3fb27SDimitry Andric             '''Return the number of targets in a lldb.SBDebugger object.'''
33*06c3fb27SDimitry Andric             return self.GetNumTargets()
34*06c3fb27SDimitry Andric     %}
35*06c3fb27SDimitry Andric #endif
36*06c3fb27SDimitry Andric 
37*06c3fb27SDimitry Andric     lldb::FileSP GetInputFileHandle() {
38*06c3fb27SDimitry Andric         return self->GetInputFile().GetFile();
39*06c3fb27SDimitry Andric     }
40*06c3fb27SDimitry Andric 
41*06c3fb27SDimitry Andric     lldb::FileSP GetOutputFileHandle() {
42*06c3fb27SDimitry Andric         return self->GetOutputFile().GetFile();
43*06c3fb27SDimitry Andric     }
44*06c3fb27SDimitry Andric 
45*06c3fb27SDimitry Andric     lldb::FileSP GetErrorFileHandle() {
46*06c3fb27SDimitry Andric         return self->GetErrorFile().GetFile();
47*06c3fb27SDimitry Andric     }
48*06c3fb27SDimitry Andric }
49