def generate_stack_output(response): values = H.unicode_string('') # Display exception name and message if S.BREAKPOINT_EXCEPTION: values += H.unicode_string('[{name}] {message}\n' \ .format(name=S.BREAKPOINT_EXCEPTION['name'], message=S.BREAKPOINT_EXCEPTION['message'])) # Walk through elements in response has_output = False try: for child in response: # Get stack attribute values if child.tag == dbgp.ELEMENT_STACK or child.tag == dbgp.ELEMENT_PATH_STACK: stack_level = child.get(dbgp.STACK_LEVEL, 0) stack_type = child.get(dbgp.STACK_TYPE) stack_file = H.url_decode(child.get(dbgp.STACK_FILENAME)) stack_line = child.get(dbgp.STACK_LINENO, 0) stack_where = child.get(dbgp.STACK_WHERE, '{unknown}') # Append values values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filename=stack_file)) has_output = True except: pass # When no stack use values from exception if not has_output and S.BREAKPOINT_EXCEPTION: values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=0, where='{unknown}', lineno=S.BREAKPOINT_EXCEPTION['lineno'], filename=S.BREAKPOINT_EXCEPTION['filename'])) return values
def get_stack_values(): """ Get stack information for current context. """ values = H.unicode_string('') if S.SESSION: try: # Get stack information S.SESSION.send(dbgp.STACK_GET) response = S.SESSION.read() for child in response: # Get stack attribute values if child.tag == dbgp.ELEMENT_STACK or child.tag == dbgp.ELEMENT_PATH_STACK: stack_level = child.get(dbgp.STACK_LEVEL, 0) stack_type = child.get(dbgp.STACK_TYPE) stack_file = H.url_decode(child.get(dbgp.STACK_FILENAME)) stack_line = child.get(dbgp.STACK_LINENO, 0) stack_where = child.get(dbgp.STACK_WHERE, '{unknown}') # Append values values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filename=stack_file)) except (socket.error, ProtocolConnectionException): e = sys.exc_info()[1] connection_error("%s" % e) return values
def generate_watch_output(): """ Generate output with all watch expressions. """ values = H.unicode_string('') if S.WATCH is None: return values for watch_data in S.WATCH: watch_entry = '' if watch_data and isinstance(watch_data, dict): # Whether watch expression is enabled or disabled if 'enabled' in watch_data.keys(): if watch_data['enabled']: watch_entry += '|+|' else: watch_entry += '|-|' # Watch expression if 'expression' in watch_data.keys(): watch_entry += ' "%s"' % watch_data['expression'] # Evaluated value if watch_data['value'] is not None: watch_entry += ' = ' + generate_context_output(watch_data['value']) else: watch_entry += "\n" values += H.unicode_string(watch_entry) return values
def generate_breakpoint_output(): """ Generate output with all configured breakpoints. """ # Get breakpoints for files values = H.unicode_string('') if S.BREAKPOINT is None: return values for filename, breakpoint_data in sorted(S.BREAKPOINT.items()): breakpoint_entry = '' if breakpoint_data: breakpoint_entry += "=> %s\n" % filename # Sort breakpoint data by line number for lineno, bp in sorted(breakpoint_data.items(), key=lambda item: (int(item[0]) if isinstance(item[0], int) or H.is_digit(item[0]) else float('inf'), item[0])): # Do not show temporary breakpoint if S.BREAKPOINT_RUN is not None and S.BREAKPOINT_RUN['filename'] == filename and S.BREAKPOINT_RUN['lineno'] == lineno: continue # Whether breakpoint is enabled or disabled breakpoint_entry += '\t' if bp['enabled']: breakpoint_entry += '|+|' else: breakpoint_entry += '|-|' # Line number breakpoint_entry += ' %s' % lineno # Conditional expression if bp['expression'] is not None: breakpoint_entry += ' -- "%s"' % bp['expression'] breakpoint_entry += "\n" values += H.unicode_string(breakpoint_entry) return values
def generate_context_output(context, indent=0): """ Generate readable context from dictionary with context data. Keyword arguments: context -- Dictionary with context data. indent -- Indent level. """ # Generate output text for values values = H.unicode_string('') if not isinstance(context, dict): return values for variable in context.values(): has_children = False property_text = '' # Set indentation for i in range(indent): property_text += '\t' # Property with value if variable['value'] is not None: if variable['name']: property_text += '{name} = ' property_text += '({type}) {value}\n' # Property with children elif isinstance(variable['children'], dict) and variable['numchildren'] is not None: has_children = True if variable['name']: property_text += '{name} = ' property_text += '{type}[{numchildren}]\n' # Unknown property else: if variable['name']: property_text += '{name} = ' property_text += '<{type}>\n' # Remove newlines in value to prevent incorrect indentation value = '' if variable['value'] and len(variable['value']) > 0: value = variable['value'].replace("\r\n", "\n").replace("\n", " ") # Format string and append to output values += H.unicode_string(property_text \ .format(value=value, type=variable['type'], name=variable['name'], numchildren=variable['numchildren'])) # Append property children to output if has_children: # Get children for property (no need to convert, already unicode) values += generate_context_output(variable['children'], indent+1) # Use ellipsis to indicate that results have been truncated limited = False if isinstance(variable['numchildren'], int) or H.is_digit(variable['numchildren']): if int(variable['numchildren']) != len(variable['children']): limited = True elif len(variable['children']) > 0 and not variable['numchildren']: limited = True if limited: for i in range(indent+1): values += H.unicode_string('\t') values += H.unicode_string('...\n') return values
def generate_stack_output(response): values = H.unicode_string('') # Display exception name and message if S.BREAKPOINT_EXCEPTION: values += H.unicode_string('[{name}] {message}\n' \ .format(name=S.BREAKPOINT_EXCEPTION['name'], message=S.BREAKPOINT_EXCEPTION['message'])) has_output = False for level, stackData in response.items(): stack_level = level stack_type = 'file' #child.get(dbgp.STACK_TYPE) stack_file = get_real_path(H.url_decode(stackData['source'])) stack_line = stackData['line'] stack_name = stackData.get( 'name', '') #child.get(dbgp.STACK_WHERE, '{unknown}') stack_namewhat = stackData[ 'namewhat'] #child.get(dbgp.STACK_WHERE, '{unknown}') if stack_namewhat != '': values += H.unicode_string('[{level}] {filename}:{lineno} - {name}({namewhat})\n' \ .format(level=stack_level, type=stack_type, name=stack_name, namewhat = stack_namewhat, lineno=stack_line, filename=stack_file)) else: values += H.unicode_string('[{level}] {filename}:{lineno}\n' \ .format(level=stack_level, type=stack_type, lineno=stack_line, filename=stack_file)) has_output = True # Walk through elements in response #try: # for child in response: # # Get stack attribute values # if child.tag == dbgp.ELEMENT_STACK or child.tag == dbgp.ELEMENT_PATH_STACK: # stack_level = child.get(dbgp.STACK_LEVEL, 0) # stack_type = child.get(dbgp.STACK_TYPE) # stack_file = H.url_decode(child.get(dbgp.STACK_FILENAME)) # stack_line = child.get(dbgp.STACK_LINENO, 0) # stack_where = child.get(dbgp.STACK_WHERE, '{unknown}') # # Append values # values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ # .format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filename=stack_file)) # has_output = True #except: # pass # When no stack use values from exception if not has_output and S.BREAKPOINT_EXCEPTION: values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=0, where='{unknown}', lineno=S.BREAKPOINT_EXCEPTION['lineno'], filename=S.BREAKPOINT_EXCEPTION['filename'])) return values
def generate_stack_output(response): values = H.unicode_string('') # Display exception name and message if S.BREAKPOINT_EXCEPTION: values += H.unicode_string('[{name}] {message}\n' \ .format(name=S.BREAKPOINT_EXCEPTION['name'], message=S.BREAKPOINT_EXCEPTION['message'])) # Walk through elements in response has_output = False try: for child in response: # Get stack attribute values if child.tag == dbgp.ELEMENT_STACK or child.tag == dbgp.ELEMENT_PATH_STACK: stack_level = child.get(dbgp.STACK_LEVEL, 0) stack_type = child.get(dbgp.STACK_TYPE) stack_file = H.url_decode(child.get(dbgp.STACK_FILENAME)) stack_line = child.get(dbgp.STACK_LINENO, 0) stack_where = child.get(dbgp.STACK_WHERE, '{unknown}') # Append values filename = os.path.basename(stack_file) values += H.unicode_string('[{level}] {lineno} {filename} {where} {filepath}\n' \ .format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filepath=stack_file, filename=filename)) has_output = True except: pass # When no stack use values from exception if not has_output and S.BREAKPOINT_EXCEPTION: filename = os.path.basename(stack_file) values += H.unicode_string('[{level}] {lineno} {filename} {where} {filepath}\n' \ .format(level=0, where='{unknown}', lineno=S.BREAKPOINT_EXCEPTION['lineno'], filepath=S.BREAKPOINT_EXCEPTION['filename'], filename=filename)) # Space all out equally lines = values.split('\n') lines_bits = [x.strip().split(' ') for x in lines] bit_widths = [] for line_bits in lines_bits: for i, line_bit in enumerate(line_bits): line_bits[i] = line_bit.strip() if len(bit_widths) <= i: bit_widths.append(0) bit_widths[i] = max(bit_widths[i], len(line_bit.strip())) new_lines = [] for i, line_bits in enumerate(lines_bits): if(len(line_bits) > 1): line_bits[1] = line_bits[1].rjust(bit_widths[1]) new_lines.append(' '.join([b.ljust(bit_widths[j]) for j, b in enumerate(line_bits)])) values = '\n'.join(new_lines) return values
def init(self): if not is_connected(): return # Connection initialization init = S.SESSION.read() # More detailed internal information on properties S.SESSION.send(dbgp.FEATURE_SET, n='show_hidden', v=1) response = S.SESSION.read() # Set max depth limit max_depth = self.get_option('max_depth', S.MAX_DEPTH) S.SESSION.send(dbgp.FEATURE_SET, n=dbgp.FEATURE_NAME_MAXDEPTH, v=max_depth) response = S.SESSION.read() # Set max children limit max_children = self.get_option('max_children', S.MAX_CHILDREN) S.SESSION.send(dbgp.FEATURE_SET, n=dbgp.FEATURE_NAME_MAXCHILDREN, v=max_children) response = S.SESSION.read() # Set breakpoints for files for filename, breakpoint_data in S.BREAKPOINT.items(): if breakpoint_data: for lineno, bp in breakpoint_data.items(): if bp['enabled']: self.set_breakpoint(filename, lineno, bp['expression']) debug('breakpoint_set: ' + filename + ':' + lineno) # Determine if client should break at first line on connect if self.get_option('break_on_start'): # Get init attribute values fileuri = init.get(dbgp.INIT_FILEURI) filename = get_real_path(fileuri) # Show debug/status output self.status_message('Xdebug: Break on start') info('Break on start: ' + filename ) # Store line number of breakpoint for displaying region marker S.BREAKPOINT_ROW = { 'filename': filename, 'lineno': 1 } # Focus/Open file window view self.timeout(lambda: show_file(filename, 1)) # Context variables context = self.get_context_values() self.timeout(lambda: show_content(DATA_CONTEXT, context)) # Stack history stack = self.get_stack_values() if not stack: stack = H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=0, where='{main}', lineno=1, filename=fileuri)) self.timeout(lambda: show_content(DATA_STACK, stack)) # Watch expressions self.watch_expression() else: # Tell script to run it's process self.run_command('xdebug_execute', {'command': 'run'})
def generate_stack_output(response): values = H.unicode_string('') # Walk through elements in response try: for child in response: # Get stack attribute values if child.tag == dbgp.ELEMENT_STACK or child.tag == dbgp.ELEMENT_PATH_STACK: stack_level = child.get(dbgp.STACK_LEVEL, 0) stack_type = child.get(dbgp.STACK_TYPE) stack_file = H.url_decode(child.get(dbgp.STACK_FILENAME)) stack_line = child.get(dbgp.STACK_LINENO, 0) stack_where = child.get(dbgp.STACK_WHERE, '{unknown}') # Append values values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filename=stack_file)) except: pass return values
def handle_break_command(self, filename, line): S.SESSION_BUSY = True filename = get_real_path(filename) # Show debug/status output self.status_message('GRLD: Break') info('Break: ' + filename) # Store line number of breakpoint for displaying region marker S.BREAKPOINT_ROW = {'filename': filename, 'lineno': str(line)} # Focus/Open file window view self.timeout(lambda: show_file(filename, line)) coroutines_dict = self.get_all_coroutines() self.update_current_thread(coroutines_dict) coroutines_str = generate_coroutines_output(coroutines_dict, self.current_thread) self.timeout(lambda: show_content(DATA_COROUTINES, coroutines_str)) # Stack history stack = self.get_stack_values() if stack: stack_levels = [int(level) for level in stack.keys()] min_stack_level = min(stack_levels) self.current_stack_level = min_stack_level stack_str = generate_stack_output(stack) else: stack_str = H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=0, where='{main}', lineno=1, filename=fileuri)) self.timeout(lambda: show_content(DATA_STACK, stack_str)) self.update_contextual_data(self.current_thread, self.current_stack_level) #self.timeout(lambda: render_regions()) S.SESSION_BUSY = False
def generate_context_output(context, indent=0, values_only=False, multiline=True): """ Generate readable context from dictionary with context data. Keyword arguments: context -- Dictionary with context data. indent -- Indent level. """ # Generate output text for values values = H.unicode_string('') if not isinstance(context, dict): return values # make sure keys are displayed in correct order keys = [int(key) for key in context.keys()] keys.sort() sorted_keys = keys for key in sorted_keys: variable = context[key] is_last_element = (key == sorted_keys[-1]) has_children = False property_text = '' # Set indentation for i in range(indent): property_text += '\t' # Property with children if 'children' in variable and isinstance( variable['children'], dict) and variable['numchildren'] is not None: has_children = True if variable['name']: property_text += '{name} = ' property_text += '{type}[{numchildren}]' # Property with value elif variable['value'] is not None: name = variable['name'] if name == '<error>': property_text += '<error> ' elif name and not values_only: property_text += '{name} = ' #property_text += '({type}) {value}\n' property_text += '{value}' # Unknown property else: if variable['name']: property_text += '{name} = ' property_text += '<{type}>' # Remove newlines in value to prevent incorrect indentation value = '' if variable['value'] and len(variable['value']) > 0: value = variable['value'].replace("\r\n", "\n").replace("\n", " ") if multiline or has_children: property_text += '\n' else: if not is_last_element: property_text += ', ' # Format string and append to output values += H.unicode_string(property_text \ .format(value=value, type=variable['type'], name=variable['name'], numchildren=variable.get('numchildren', 0))) # Append property children to output if has_children: # Get children for property (no need to convert, already unicode) values += generate_context_output(variable['children'], indent + 1) # Use ellipsis to indicate that results have been truncated limited = False if isinstance(variable['numchildren'], int) or H.is_digit( variable['numchildren']): if int(variable['numchildren']) != len(variable['children']): limited = True elif len(variable['children']) > 0 and not variable['numchildren']: limited = True if limited: for i in range(indent + 1): values += H.unicode_string('\t') values += H.unicode_string('...\n') return values
(0x1FFFE, 0x1FFFF), (0x2FFFE, 0x2FFFF), (0x3FFFE, 0x3FFFF), (0x4FFFE, 0x4FFFF), (0x5FFFE, 0x5FFFF), (0x6FFFE, 0x6FFFF), (0x7FFFE, 0x7FFFF), (0x8FFFE, 0x8FFFF), (0x9FFFE, 0x9FFFF), (0xAFFFE, 0xAFFFF), (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF), (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF), (0xFFFFE, 0xFFFFF), (0x10FFFE, 0x10FFFF)] ILLEGAL_XML_RANGES = [ '%s-%s' % (H.unicode_chr(low), H.unicode_chr(high)) for (low, high) in ILLEGAL_XML_UNICODE_CHARACTERS if low < sys.maxunicode ] ILLEGAL_XML_RE = re.compile( H.unicode_string('[%s]') % H.unicode_string('').join(ILLEGAL_XML_RANGES)) class Protocol(object): """ Class for connecting with debugger engine which uses DBGp protocol. """ # Maximum amount of data to be received at once by socket read_size = 1024 def __init__(self): # Set host address to listen for response self.host = get_value(S.KEY_HOST, S.DEFAULT_HOST) # Set port number to listen for response self.port = get_value(S.KEY_PORT, S.DEFAULT_PORT)
def init(self): debug('(SocketHandler.init) Begin (%s)' % self.name) if not is_connected(show_status=True): debug( '(SocketHandler.init) Client is not connected to debugger engine' ) debug('(SocketHandler.init) Done (%s)' % self.name) return # Connection initialization debug('(SocketHandler.init) Connection initialisation') init = S.SESSION.read() # More detailed internal information on properties debug( '(SocketHandler.init) Asking for more detailed internal information on properties' ) S.SESSION.send(dbgp.FEATURE_SET, n='show_hidden', v=1) response = S.SESSION.read() # Set max children limit max_children = get_value(S.KEY_MAX_CHILDREN) if max_children is not False and max_children is not True and ( H.is_number(max_children) or H.is_digit(max_children)): debug('(SocketHandler.init) Setting max children limit to %s' % max_children) S.SESSION.send(dbgp.FEATURE_SET, n=dbgp.FEATURE_NAME_MAXCHILDREN, v=max_children) response = S.SESSION.read() # Set max data limit max_data = get_value(S.KEY_MAX_DATA) if max_data is not False and max_data is not True and ( H.is_number(max_data) or H.is_digit(max_data)): debug('(SocketHandler.init) Setting max data limit to %s' % max_data) S.SESSION.send(dbgp.FEATURE_SET, n=dbgp.FEATURE_NAME_MAXDATA, v=max_data) response = S.SESSION.read() # Set max depth limit max_depth = get_value(S.KEY_MAX_DEPTH) if max_depth is not False and max_depth is not True and ( H.is_number(max_depth) or H.is_digit(max_depth)): debug('(SocketHandler.init) Setting max depth limit to %s' % max_depth) S.SESSION.send(dbgp.FEATURE_SET, n=dbgp.FEATURE_NAME_MAXDEPTH, v=max_depth) response = S.SESSION.read() # Set breakpoints for files debug('(SocketHandler.init) Setting breakpoints for files') for filename, breakpoint_data in S.BREAKPOINT.items(): if breakpoint_data: for lineno, bp in breakpoint_data.items(): if bp['enabled']: self.set_breakpoint(filename, lineno, bp['expression']) debug('(SocketHandler.init) Breakpoint set: ' + filename + ':' + lineno) # Set breakpoints for exceptions debug('(SocketHandler.init) Setting breakpoints for exceptions') break_on_exception = get_value(S.KEY_BREAK_ON_EXCEPTION) if isinstance(break_on_exception, list): for exception_name in break_on_exception: self.set_exception(exception_name) debug('(SocketHandler.init) Exception breakpoint set: ' + exception_name) # List breakpoints (write to debug log) debug('(SocketHandler.init) Listing breakpoints') S.SESSION.send(dbgp.BREAKPOINT_LIST) response = S.SESSION.read() # Determine if client should break at first line on connect if get_value(S.KEY_BREAK_ON_START): # Get init attribute values fileuri = init.get(dbgp.INIT_FILEURI) filename = get_real_path(fileuri) # Show debug/status output self.status_message('Xdebug: Break on start') info('(SocketHandler.init) Break on start: ' + filename) # Store line number of breakpoint for displaying region marker S.BREAKPOINT_ROW = {'filename': filename, 'lineno': 1} # Focus/Open file window view self.timeout(lambda: show_file(filename, 1)) # Context variables context = self.get_context_values() self.timeout(lambda: show_content(DATA_CONTEXT, context)) # Stack history stack = self.get_stack_values() if not stack: stack = H.unicode_string('[{level}] {filename}.{where}:{lineno}\n' \ .format(level=0, where='{main}', lineno=1, filename=fileuri)) self.timeout(lambda: show_content(DATA_STACK, stack)) # Watch expressions self.watch_expression() else: # Tell script to run it's process self.run_command('xdebug_execute', {'command': 'run'}) debug('(SocketHandler.init) Done (%s)' % self.name)
def generate_controls_output(): content = '<Run>\n<Step Over> <Step Into> <Step Out>\n<Evaluate> <Stop> <Detach>\n<Auto Evaluate>' if S.AUTO_EVALUATE is not None: content += '\n' + S.AUTO_EVALUATE return H.unicode_string(content)
ILLEGAL_XML_UNICODE_CHARACTERS = [ (0x00, 0x08), (0x0B, 0x0C), (0x0E, 0x1F), (0x7F, 0x84), (0x86, 0x9F), (0xD800, 0xDFFF), (0xFDD0, 0xFDDF), (0xFFFE, 0xFFFF), (0x1FFFE, 0x1FFFF), (0x2FFFE, 0x2FFFF), (0x3FFFE, 0x3FFFF), (0x4FFFE, 0x4FFFF), (0x5FFFE, 0x5FFFF), (0x6FFFE, 0x6FFFF), (0x7FFFE, 0x7FFFF), (0x8FFFE, 0x8FFFF), (0x9FFFE, 0x9FFFF), (0xAFFFE, 0xAFFFF), (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF), (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF), (0xFFFFE, 0xFFFFF), (0x10FFFE, 0x10FFFF) ] ILLEGAL_XML_RANGES = ["%s-%s" % (H.unicode_chr(low), H.unicode_chr(high)) for (low, high) in ILLEGAL_XML_UNICODE_CHARACTERS if low < sys.maxunicode] ILLEGAL_XML_RE = re.compile(H.unicode_string('[%s]') % H.unicode_string('').join(ILLEGAL_XML_RANGES)) class Protocol(object): """ Class for connecting with debugger engine which uses DBGp protocol. """ # Maximum amount of data to be received at once by socket read_size = 1024 def __init__(self): # Set port number to listen for response self.port = get_value(S.KEY_PORT, S.DEFAULT_PORT) self.clear()
(0x86, 0x9F), (0xD800, 0xDFFF), (0xFDD0, 0xFDDF), (0xFFFE, 0xFFFF), (0x1FFFE, 0x1FFFF), (0x2FFFE, 0x2FFFF), (0x3FFFE, 0x3FFFF), (0x4FFFE, 0x4FFFF), (0x5FFFE, 0x5FFFF), (0x6FFFE, 0x6FFFF), (0x7FFFE, 0x7FFFF), (0x8FFFE, 0x8FFFF), (0x9FFFE, 0x9FFFF), (0xAFFFE, 0xAFFFF), (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF), (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF), (0xFFFFE, 0xFFFFF), (0x10FFFE, 0x10FFFF)] ILLEGAL_XML_RANGES = [ '%s-%s' % (H.unicode_chr(low), H.unicode_chr(high)) for (low, high) in ILLEGAL_XML_UNICODE_CHARACTERS if low < sys.maxunicode ] ILLEGAL_XML_RE = re.compile(H.unicode_string('[%s]') % H.unicode_string('').join(ILLEGAL_XML_RANGES)) class Protocol(object): """ Class for connecting with debugger engine which uses DBGp protocol. """ # Maximum amount of data to be received at once by socket read_size = 1024 def __init__(self): # Set host address to listen for response self.host = get_value(S.KEY_HOST, S.DEFAULT_HOST) # Set port number to listen for response self.port = get_value(S.KEY_PORT, S.DEFAULT_PORT)
(0xAFFFE, 0xAFFFF), (0xBFFFE, 0xBFFFF), (0xCFFFE, 0xCFFFF), (0xDFFFE, 0xDFFFF), (0xEFFFE, 0xEFFFF), (0xFFFFE, 0xFFFFF), (0x10FFFE, 0x10FFFF), ] ILLEGAL_XML_RANGES = [ "%s-%s" % (H.unicode_chr(low), H.unicode_chr(high)) for (low, high) in ILLEGAL_XML_UNICODE_CHARACTERS if low < sys.maxunicode ] ILLEGAL_XML_RE = re.compile(H.unicode_string("[%s]") % H.unicode_string("").join(ILLEGAL_XML_RANGES)) class Protocol(object): """ Class for connecting with debugger engine which uses DBGp protocol. """ # Maximum amount of data to be received at once by socket read_size = 1024 def __init__(self): # Set port number to listen for response self.port = get_value(S.KEY_PORT, S.DEFAULT_PORT) self.clear()