Skip to content

Commit

Permalink
Also update the disassembly output to match the new flag values
Browse files Browse the repository at this point in the history
  • Loading branch information
zrax committed Aug 4, 2024
1 parent 0942dec commit c925daf
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pycdas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ static const char* flag_names[] = {
"CO_OPTIMIZED", "CO_NEWLOCALS", "CO_VARARGS", "CO_VARKEYWORDS",
"CO_NESTED", "CO_GENERATOR", "CO_NOFREE", "CO_COROUTINE",
"CO_ITERABLE_COROUTINE", "<0x200>", "<0x400>", "<0x800>",
"CO_GENERATOR_ALLOWED", "CO_FUTURE_DIVISION",
"CO_FUTURE_ABSOLUTE_IMPORT", "CO_FUTURE_WITH_STATEMENT",
"CO_FUTURE_PRINT_FUNCTION", "CO_FUTURE_UNICODE_LITERALS",
"CO_FUTURE_BARRY_AS_BDFL", "CO_FUTURE_GENERATOR_STOP",
"<0x100000>", "<0x200000>", "<0x400000>", "<0x800000>",
"<0x1000000>", "<0x2000000>", "<0x4000000>", "<0x8000000>",
"CO_GENERATOR_ALLOWED", "<0x2000>", "<0x4000>", "<0x8000>",
"<0x10000>", "CO_FUTURE_DIVISION", "CO_FUTURE_ABSOLUTE_IMPORT", "CO_FUTURE_WITH_STATEMENT",
"CO_FUTURE_PRINT_FUNCTION", "CO_FUTURE_UNICODE_LITERALS", "CO_FUTURE_BARRY_AS_BDFL",
"CO_FUTURE_GENERATOR_STOP",
"CO_FUTURE_ANNOTATIONS", "CO_NO_MONITORING_EVENTS", "<0x4000000>", "<0x8000000>",
"<0x10000000>", "<0x20000000>", "<0x40000000>", "<0x80000000>"
};

Expand Down Expand Up @@ -102,7 +101,12 @@ void output_object(PycRef<PycObject> obj, PycModule* mod, int indent,
if (mod->verCompare(1, 5) >= 0)
iprintf(pyc_output, indent + 1, "Stack Size: %d\n", codeObj->stackSize());
if (mod->verCompare(1, 3) >= 0) {
iprintf(pyc_output, indent + 1, "Flags: 0x%08X", codeObj->flags());
unsigned int orig_flags = codeObj->flags();
if (mod->verCompare(3, 8) < 0) {
// Remap flags back to the value stored in the PyCode object
orig_flags = (orig_flags & 0xFFFF) | ((orig_flags & 0xFFF00000) >> 4);
}
iprintf(pyc_output, indent + 1, "Flags: 0x%08X", orig_flags);
print_coflags(codeObj->flags(), pyc_output);
}

Expand Down

0 comments on commit c925daf

Please sign in to comment.