brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 7895fcd Raw
62 lines · plain
1STRING_EXTENSION_OUTSIDE(SBDebugger)2 3%extend lldb::SBDebugger {4#ifdef SWIGPYTHON5    %pythoncode %{6        def SetOutputFileHandle(self, file, transfer_ownership):7            "DEPRECATED, use SetOutputFile"8            if file is None:9                import sys10                file = sys.stdout11            self.SetOutputFile(SBFile.Create(file, borrow=True))12 13        def SetInputFileHandle(self, file, transfer_ownership):14            "DEPRECATED, use SetInputFile"15            if file is None:16                import sys17                file = sys.stdin18            self.SetInputFile(SBFile.Create(file, borrow=True))19 20        def SetErrorFileHandle(self, file, transfer_ownership):21            "DEPRECATED, use SetErrorFile"22            if file is None:23                import sys24                file = sys.stderr25            self.SetErrorFile(SBFile.Create(file, borrow=True))26 27        def __iter__(self):28            '''Iterate over all targets in a lldb.SBDebugger object.'''29            return lldb_iter(self, 'GetNumTargets', 'GetTargetAtIndex')30 31        def __len__(self):32            '''Return the number of targets in a lldb.SBDebugger object.'''33            return self.GetNumTargets()34    %}35#endif36 37    lldb::FileSP GetInputFileHandle() {38        return self->GetInputFile().GetFile();39    }40 41    lldb::FileSP GetOutputFileHandle() {42        return self->GetOutputFile().GetFile();43    }44 45    lldb::FileSP GetErrorFileHandle() {46        return self->GetErrorFile().GetFile();47    }48 49#ifdef SWIGPYTHON50    %pythoncode %{51        class staticproperty:52            def __init__(self, func):53                self.func = func54            def __get__(self, instance, owner):55                return self.func()56        @staticproperty57        def version():58            return SBDebugger.GetVersionString()59    %}60#endif61}62