def create_signature_message(signature): cmdTextList = ["<xml>"] cmdTextList.append('<call_signature file="%s" name="%s">' % (pydevd_vars.make_valid_xml_value(signature.file), pydevd_vars.make_valid_xml_value(signature.name))) for arg in signature.args: cmdTextList.append('<arg name="%s" type="%s"></arg>' % (pydevd_vars.make_valid_xml_value(arg[0]), pydevd_vars.make_valid_xml_value(arg[1]))) cmdTextList.append("</call_signature></xml>") cmdText = ''.join(cmdTextList) return NetCommand(CMD_SIGNATURE_CALL_TRACE, 0, cmdText)
def get_text_list_for_frame(frame): # partial copy-paste from make_thread_suspend_str curFrame = frame cmdTextList = [] try: while curFrame: #print cmdText myId = str(id(curFrame)) #print "id is ", myId if curFrame.f_code is None: break #Iron Python sometimes does not have it! myName = curFrame.f_code.co_name #method name (if in method) or ? if global if myName is None: break #Iron Python sometimes does not have it! #print "name is ", myName filename = pydevd_file_utils.get_abs_path_real_path_and_base_from_frame( curFrame)[1] myFile = pydevd_file_utils.norm_file_to_client(filename) if file_system_encoding.lower() != "utf-8" and hasattr( myFile, "decode"): # myFile is a byte string encoded using the file system encoding # convert it to utf8 myFile = myFile.decode(file_system_encoding).encode("utf-8") #print "file is ", myFile #myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame) myLine = str(curFrame.f_lineno) #print "line is ", myLine #the variables are all gotten 'on-demand' #variables = pydevd_vars.frame_vars_to_xml(curFrame.f_locals) variables = '' cmdTextList.append( '<frame id="%s" name="%s" ' % (myId, pydevd_vars.make_valid_xml_value(myName))) cmdTextList.append('file="%s" line="%s">' % (quote(myFile, '/>_= \t'), myLine)) cmdTextList.append(variables) cmdTextList.append("</frame>") curFrame = curFrame.f_back except: traceback.print_exc() return cmdTextList
def send_message(event_class, time, name, thread_id, type, event, file, line, frame, lock_id=0, parent=None): dbg = GlobalDebuggerHolder.global_dbg cmdTextList = ['<xml>'] cmdTextList.append('<' + event_class) cmdTextList.append(' time="%s"' % pydevd_vars.make_valid_xml_value(str(time))) cmdTextList.append(' name="%s"' % pydevd_vars.make_valid_xml_value(name)) cmdTextList.append(' thread_id="%s"' % pydevd_vars.make_valid_xml_value(thread_id)) cmdTextList.append(' type="%s"' % pydevd_vars.make_valid_xml_value(type)) if type == "lock": cmdTextList.append(' lock_id="%s"' % pydevd_vars.make_valid_xml_value(str(lock_id))) if parent is not None: cmdTextList.append(' parent="%s"' % pydevd_vars.make_valid_xml_value(parent)) cmdTextList.append(' event="%s"' % pydevd_vars.make_valid_xml_value(event)) cmdTextList.append(' file="%s"' % pydevd_vars.make_valid_xml_value(file)) cmdTextList.append(' line="%s"' % pydevd_vars.make_valid_xml_value(str(line))) cmdTextList.append('></' + event_class + '>') cmdTextList += get_text_list_for_frame(frame) cmdTextList.append('</xml>') text = ''.join(cmdTextList) if dbg.writer is not None: dbg.writer.add_command(NetCommand(145, 0, text))
def get_text_list_for_frame(frame): # partial copy-paste from make_thread_suspend_str curFrame = frame cmdTextList = [] try: while curFrame: #print cmdText myId = str(id(curFrame)) #print "id is ", myId if curFrame.f_code is None: break #Iron Python sometimes does not have it! myName = curFrame.f_code.co_name #method name (if in method) or ? if global if myName is None: break #Iron Python sometimes does not have it! #print "name is ", myName filename = pydevd_file_utils.get_abs_path_real_path_and_base_from_frame(curFrame)[1] myFile = pydevd_file_utils.norm_file_to_client(filename) if file_system_encoding.lower() != "utf-8" and hasattr(myFile, "decode"): # myFile is a byte string encoded using the file system encoding # convert it to utf8 myFile = myFile.decode(file_system_encoding).encode("utf-8") #print "file is ", myFile #myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame) myLine = str(curFrame.f_lineno) #print "line is ", myLine #the variables are all gotten 'on-demand' #variables = pydevd_vars.frame_vars_to_xml(curFrame.f_locals) variables = '' cmdTextList.append('<frame id="%s" name="%s" ' % (myId , pydevd_vars.make_valid_xml_value(myName))) cmdTextList.append('file="%s" line="%s">' % (quote(myFile, '/>_= \t'), myLine)) cmdTextList.append(variables) cmdTextList.append("</frame>") curFrame = curFrame.f_back except : traceback.print_exc() return cmdTextList
def send_message(event_class, time, name, thread_id, type, event, file, line, frame, lock_id=0, parent=None): dbg = GlobalDebuggerHolder.global_dbg cmdTextList = ['<xml>'] cmdTextList.append('<' + event_class) cmdTextList.append(' time="%s"' % pydevd_vars.make_valid_xml_value(str(time))) cmdTextList.append(' name="%s"' % pydevd_vars.make_valid_xml_value(name)) cmdTextList.append(' thread_id="%s"' % pydevd_vars.make_valid_xml_value(thread_id)) cmdTextList.append(' type="%s"' % pydevd_vars.make_valid_xml_value(type)) if type == "lock": cmdTextList.append(' lock_id="%s"' % pydevd_vars.make_valid_xml_value(str(lock_id))) if parent is not None: cmdTextList.append(' parent="%s"' % pydevd_vars.make_valid_xml_value(parent)) cmdTextList.append(' event="%s"' % pydevd_vars.make_valid_xml_value(event)) cmdTextList.append(' file="%s"' % pydevd_vars.make_valid_xml_value(file)) cmdTextList.append(' line="%s"' % pydevd_vars.make_valid_xml_value(str(line))) cmdTextList.append('></' + event_class + '>') cmdTextList += get_text_list_for_frame(frame) cmdTextList.append('</xml>') text = ''.join(cmdTextList) if dbg.writer is not None: dbg.writer.add_command(NetCommand(145, 0, text))