eric6/DebugClients/Python/DebugBase.py

changeset 7711
5e6792b85a8a
parent 7707
6abcf4275d0e
child 7714
79bde78e3e16
equal deleted inserted replaced
7710:9aad21c7765d 7711:5e6792b85a8a
929 @param frame frame object to be disassembled 929 @param frame frame object to be disassembled
930 @type code 930 @type code
931 @return dictionary containing the disassembly information 931 @return dictionary containing the disassembly information
932 @rtype dict 932 @rtype dict
933 """ 933 """
934 co = frame.f_code
934 disDict = { 935 disDict = {
935 "lasti": frame.f_lasti, 936 "lasti": frame.f_lasti,
936 "firstlineno": frame.f_code.co_firstlineno, 937 "firstlineno": co.co_firstlineno,
937 "instructions": [], 938 "instructions": [],
938 } 939 }
939 for instr in dis.get_instructions(frame.f_code): 940
941 # 1. disassembly info
942 for instr in dis.get_instructions(co):
940 instrDict = { 943 instrDict = {
941 "lineno": 944 "lineno":
942 0 if instr.starts_line is None else instr.starts_line, 945 0 if instr.starts_line is None else instr.starts_line,
943 "isJumpTarget": instr.is_jump_target, 946 "isJumpTarget": instr.is_jump_target,
944 "offset": instr.offset, 947 "offset": instr.offset,
945 "opname": instr.opname, 948 "opname": instr.opname,
946 "arg": instr.arg, 949 "arg": instr.arg,
947 "argrepr": instr.argrepr, 950 "argrepr": instr.argrepr,
948 } 951 }
949 disDict["instructions"].append(instrDict) 952 disDict["instructions"].append(instrDict)
953
954 # 2. code info
955 # Note: keep in sync with PythonDisViewer.__createCodeInfo()
956 disDict["codeinfo"] = {
957 "name": co.co_name,
958 "filename": co.co_filename,
959 "firstlineno": co.co_firstlineno,
960 "argcount": co.co_argcount,
961 "posonlyargcount": co.co_posonlyargcount,
962 "kwonlyargcount": co.co_kwonlyargcount,
963 "nlocals": co.co_nlocals,
964 "stacksize": co.co_stacksize,
965 "flags": dis.pretty_flags(co.co_flags),
966 "consts": [str(const) for const in co.co_consts],
967 "names": [str(name) for name in co.co_names],
968 "varnames": [str(name) for name in co.co_varnames],
969 "freevars": [str(var) for var in co.co_freevars],
970 "cellvars": [str(var) for var in co.co_cellvars],
971 }
950 972
951 return disDict 973 return disDict
952 974
953 def __extractSystemExitMessage(self, excinfo): 975 def __extractSystemExitMessage(self, excinfo):
954 """ 976 """

eric ide

mercurial