--- a/eric6/DebugClients/Python/DebugBase.py Tue Sep 22 19:30:03 2020 +0200 +++ b/eric6/DebugClients/Python/DebugBase.py Wed Sep 23 19:10:42 2020 +0200 @@ -931,12 +931,15 @@ @return dictionary containing the disassembly information @rtype dict """ + co = frame.f_code disDict = { "lasti": frame.f_lasti, - "firstlineno": frame.f_code.co_firstlineno, + "firstlineno": co.co_firstlineno, "instructions": [], } - for instr in dis.get_instructions(frame.f_code): + + # 1. disassembly info + for instr in dis.get_instructions(co): instrDict = { "lineno": 0 if instr.starts_line is None else instr.starts_line, @@ -948,6 +951,25 @@ } disDict["instructions"].append(instrDict) + # 2. code info + # Note: keep in sync with PythonDisViewer.__createCodeInfo() + disDict["codeinfo"] = { + "name": co.co_name, + "filename": co.co_filename, + "firstlineno": co.co_firstlineno, + "argcount": co.co_argcount, + "posonlyargcount": co.co_posonlyargcount, + "kwonlyargcount": co.co_kwonlyargcount, + "nlocals": co.co_nlocals, + "stacksize": co.co_stacksize, + "flags": dis.pretty_flags(co.co_flags), + "consts": [str(const) for const in co.co_consts], + "names": [str(name) for name in co.co_names], + "varnames": [str(name) for name in co.co_varnames], + "freevars": [str(var) for var in co.co_freevars], + "cellvars": [str(var) for var in co.co_cellvars], + } + return disDict def __extractSystemExitMessage(self, excinfo):