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)