Rizin
unix-like reverse engineering framework and cli tools
opcode_39.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2020 FXTi <zjxiang1998@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include "opcode.h"
5 
7  pyc_opcodes *ret = opcode_38();
8  if (!ret) {
9  return NULL;
10  }
11 
12  ret->version_sig = (void *(*)())opcode_39;
13 
14  // These are removed since 3.8...
15  rm_op(.op_obj = ret->opcodes, .op_name = "BEGIN_FINALLY", .op_code = 53);
16  rm_op(.op_obj = ret->opcodes, .op_name = "WITH_CLEANUP_START", .op_code = 81);
17  rm_op(.op_obj = ret->opcodes, .op_name = "WITH_CLEANUP_FINISH", .op_code = 82);
18  rm_op(.op_obj = ret->opcodes, .op_name = "END_FINALLY", .op_code = 88);
19  rm_op(.op_obj = ret->opcodes, .op_name = "CALL_FINALLY", .op_code = 162);
20  rm_op(.op_obj = ret->opcodes, .op_name = "POP_FINALLY", .op_code = 163);
21 
22  // These are new since Python 3.9
23  // OP NAME OPCODE POP PUSH
24  def_op(.op_obj = ret->opcodes, .op_name = "RERAISE", .op_code = 48, .pop = 0, .push = 0);
25  def_op(.op_obj = ret->opcodes, .op_name = "WITH_EXCEPT_START", .op_code = 49, .pop = 3, .push = 0);
26  def_op(.op_obj = ret->opcodes, .op_name = "LOAD_ASSERTION_ERROR", .op_code = 74, .pop = 0, .push = 1);
27 
29  add_arg_fmt(ret, "CALL_FUNCTION_KW", format_CALL_FUNCTION_KW_36);
30  add_arg_fmt(ret, "CALL_FUNCTION_EX", format_CALL_FUNCTION_EX_36);
31  add_arg_fmt(ret, "MAKE_FUNCTION", format_MAKE_FUNCTION_arg_36);
32  add_arg_fmt(ret, "FORMAT_VALUE", format_value_flags_36);
33  add_arg_fmt(ret, "EXTENDED_ARG", format_extended_arg_36);
34 
35  return ret;
36 }
#define NULL
Definition: cris-opc.c:27
RZ_API void rz_list_purge(RZ_NONNULL RzList *list)
Empties the list without freeing the list pointer.
Definition: list.c:120
void add_arg_fmt(pyc_opcodes *ret, char *op_name, const char *(*formatter)(ut32 oparg))
Definition: opcode.c:234
pyc_opcodes * opcode_39(void)
Definition: opcode_39.c:6
const char * format_MAKE_FUNCTION_arg_36(ut32 oparg)
const char * format_CALL_FUNCTION_KW_36(ut32 oparg)
pyc_opcodes * opcode_38(void)
Definition: opcode_38.c:6
const char * format_extended_arg_36(ut32 oparg)
#define def_op(...)
Definition: opcode.h:127
#define rm_op(...)
Definition: opcode.h:175
const char * format_CALL_FUNCTION_EX_36(ut32 oparg)
const char * format_value_flags_36(ut32 oparg)
char * op_name
Definition: opcode.h:38
void *(* version_sig)()
Definition: opcode.h:49
pyc_opcode_object * opcodes
Definition: opcode.h:51
RzList * opcode_arg_fmt
Definition: opcode.h:50