Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sweeneyde opened this issue Apr 10, 2022 · 0 comments · May be fixed by #91467
Open

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

sweeneyde opened this issue Apr 10, 2022 · 0 comments · May be fixed by #91467

Comments

@sweeneyde
Copy link
Member

@sweeneyde sweeneyde commented Apr 10, 2022

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant