Skip to content

Add opname array to opcode.h of debug builds. #91428

Closed
@sweeneyde

Description

@sweeneyde

I suggest to include the following in opcode.h:

#ifdef Py_DEBUG
const char *const _PyOpcode_OpName[256] = {
    [0] = "CACHE",
    [1] = "POP_TOP",
    ...
    [255] = "DO_TRACING",
};
#endif

The goal is to make debugging easier. Possible uses:

  • This would greatly improve the readability of the output of the LLTRACE feature of ceval.
  • This could help make opcode stats files readable between different interpreters without worry of opcode mismatches.
  • Other debugging faculties like the #if 0-ed out dump_instr and dump_basicblock of compile.c become easier to understand.
  • One-off printf-style debugging of ceval.c and related functionality becomes easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions