def send(self, data, channel='default'): s_data = serialize(data) formatted_data = channel + '\n' + str(len(s_data)) + '\n' + s_data exception = None try: sent = self.socket.send(H.data_write(formatted_data)) except socket.error as e: sent = 0 exception = e if sent == 0: self.disconnect(exception)
def send(self, command, *args, **kwargs): """ Send command to the debugger engine according to DBGp protocol. """ # Expression is used for conditional and watch type breakpoints expression = None # Separate 'expression' from kwargs if 'expression' in kwargs: expression = kwargs['expression'] del kwargs['expression'] # Generate unique Transaction ID transaction_id = self.transaction_id # Append command/arguments to build list build_command = [command, '-i %i' % transaction_id] if args: build_command.extend(args) if kwargs: build_command.extend(['-%s %s' % pair for pair in kwargs.items()]) # Remove leading/trailing spaces and build command string build_command = [ part.strip() for part in build_command if part.strip() ] command = ' '.join(build_command) if expression: command += ' -- ' + H.base64_encode(expression) # Show debug output debug('[Send command] %s' % command) # Send command to debugger engine try: self.socket.send(H.data_write(command + '\x00')) except: e = sys.exc_info()[1] raise ProtocolConnectionException(e)
def send(self, command, *args, **kwargs): """ Send command to the debugger engine according to DBGp protocol. """ # Expression is used for conditional and watch type breakpoints expression = None # Seperate 'expression' from kwargs if 'expression' in kwargs: expression = kwargs['expression'] del kwargs['expression'] # Generate unique Transaction ID transaction_id = self.transaction_id # Append command/arguments to build list build_command = [command, '-i %i' % transaction_id] if args: build_command.extend(args) if kwargs: build_command.extend(['-%s %s' % pair for pair in kwargs.items()]) # Remove leading/trailing spaces and build command string build_command = [part.strip() for part in build_command if part.strip()] command = ' '.join(build_command) if expression: command += ' -- ' + H.base64_encode(expression) # Show debug output debug('[Send command] %s' % command) # Send command to debugger engine try: self.socket.send(H.data_write(command + '\x00')) except: e = sys.exc_info()[1] raise ProtocolConnectionException(e)
def save_watch_data(): data_path = os.path.join(sublime.packages_path(), 'User', S.FILE_WATCH_DATA) with open(data_path, 'wb') as data: data.write(H.data_write(json.dumps(S.WATCH)))
def save_breakpoint_data(): data_path = os.path.join(sublime.packages_path(), 'User', S.FILE_BREAKPOINT_DATA) with open(data_path, 'wb') as data: data.write(H.data_write(json.dumps(S.BREAKPOINT)))