IDAPython for IDA 8.0

This commit is contained in:
Arnaud Diederen
2022-08-22 10:14:08 +02:00
parent 1e0b352e00
commit 023c5ba53c
108 changed files with 38145 additions and 32850 deletions
+1 -2
View File
@@ -13,11 +13,10 @@ REQUIREMENTS
- IDA and IDA SDK [> 5.6]
http://www.hex-rays.com/idapro/
- Python [2.5.1, 2.6.1, 2.7]
- Python 3.x
http://www.python.org/
- Simplified Wrapper Interface Generator (SWIG)
- if you intend to build for Python 2.x: [4.0.1]
- if you intend to build for Python 3.x: [4.0.1, with support for -py3-limited-api]
Hex-Rays cannot guarantee support for IDAPython
+2 -30
View File
@@ -1,34 +1,6 @@
IDAPython requires a Python3.x installation in order to work.
IDAPython comes in two flavors:
* IDAPython-for-Python2.7
* IDAPython-for-Python3.x
# Switching between IDAPython-for-Python2.7, and IDAPython-for-Python3.x.
IDA ships with two versions of IDAPython:
* one that runs using the Python2.7 runtime
* one that runs using the Python3.x runtime
By default, IDA will load the one that runs using the Python3.x runtime.
In order to have IDA use IDAPython-on-Python2.7, the file
'use_python2' needs to be present in the 'python' subdirectory.
That file will be looked for in the following places:
* IDA's install path: path/to/ida_install/python/use_python2
* The 'IDAUSR' directory:
+ ~/.idapro/python/use_python2 (on Linux/OSX)
+ %APPDATA%\Hex-Rays\IDA Pro\python\use_python2 (on Windows)
+ [...or any other directory if the environment variable $IDAUSR is set]
# Selecting which Python3.x install runtime to use
The situation for IDAPython-for-Python2.7 is simple: it uses Python 2.7,
and will expect that [lib]python2.7.[dll|so|dylib] is present in the system
library path so that IDA can find it.
But when it comes to IDAPython-for-Python3.x, things gets more complex:
because different users might have different (and possibly multiple)
Because different users might have different (and possibly multiple)
versions of Python3.x installed, IDA comes with a tool called `idapyswitch`
that can be run to select the desired Python3.x runtime.
+285 -92
View File
@@ -1925,6 +1925,15 @@
'chooser_item_attrs_t_flags_get',
'chooser_item_attrs_t_flags_set',
'chooser_item_attrs_t_reset',
'chooser_stdact_desc_t_icon_get',
'chooser_stdact_desc_t_icon_set',
'chooser_stdact_desc_t_label_get',
'chooser_stdact_desc_t_label_set',
'chooser_stdact_desc_t_tooltip_get',
'chooser_stdact_desc_t_tooltip_set',
'chooser_stdact_desc_t_ucb',
'chooser_stdact_desc_t_version_get',
'chooser_stdact_desc_t_version_set',
'chunk_size',
'chunk_start',
'cif_t___eq__',
@@ -2132,7 +2141,6 @@
'clr_lzero',
'clr_lzero0',
'clr_lzero1',
'clr_module_data',
'clr_node_info',
'clr_noret',
'clr_notcode',
@@ -2295,6 +2303,8 @@
'create_memory_linput',
'create_menu',
'create_mutable_graph',
'create_nodeval_merge_handler',
'create_nodeval_merge_handlers',
'create_numbered_type_name',
'create_outctx',
'create_oword',
@@ -2303,6 +2313,7 @@
'create_simple_diff_handler',
'create_simple_idb_diff_handler',
'create_source_viewer',
'create_std_modmerge_handlers',
'create_strlit',
'create_struct',
'create_switch_table',
@@ -2698,6 +2709,7 @@
'delete_channel_redir_t',
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_chooser_stdact_desc_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
@@ -2813,6 +2825,8 @@
'delete_history_t',
'delete_ida_lowertype_helper_t',
'delete_idaplace_t',
'delete_idbattr_info_t',
'delete_idbattr_valmap_t',
'delete_idc_global_t',
'delete_idc_value_t',
'delete_idc_values_t',
@@ -2831,10 +2845,12 @@
'delete_insn_site_t',
'delete_insn_t',
'delete_instant_dbgopts_t',
'delete_int64vec_t',
'delete_int_pointer',
'delete_interval_t',
'delete_intvec_t',
'delete_ioports_fallback_t',
'delete_item_block_locator_t',
'delete_iterator',
'delete_ivl_t',
'delete_ivl_with_name_t',
@@ -2850,7 +2866,6 @@
'delete_lochist_t',
'delete_lock_func',
'delete_lock_segment',
'delete_longlongvec_t',
'delete_lowertype_helper_t',
'delete_lumina_client_t',
'delete_lumina_op_res_vec_t',
@@ -2879,6 +2894,9 @@
'delete_memreg_info_t',
'delete_memreg_infos_t',
'delete_menu',
'delete_merge_handler_params_t',
'delete_merge_node_helper_t',
'delete_merge_node_info_t',
'delete_metadata_iterator_t',
'delete_microcode_filter_t',
'delete_minsn_t',
@@ -2886,6 +2904,7 @@
'delete_mlist_mop_visitor_t',
'delete_mlist_t',
'delete_mnumber_t',
'delete_moddata_diff_helper_t',
'delete_modinfo_t',
'delete_mop_addr_t',
'delete_mop_pair_t',
@@ -2901,6 +2920,7 @@
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_octet_generator_t',
'delete_op_parent_info_t',
'delete_op_t',
'delete_operand_locator_t',
@@ -2979,6 +2999,7 @@
'delete_segm_move_info_t',
'delete_segm_move_info_vec_t',
'delete_segm_move_infos_t',
'delete_segment_defsr_array',
'delete_segment_t',
'delete_seh_t',
'delete_sel_array',
@@ -3050,8 +3071,8 @@
'delete_ui_stroff_applicator_t',
'delete_ui_stroff_op_t',
'delete_ui_stroff_ops_t',
'delete_uint64vec_t',
'delete_uintvec_t',
'delete_ulonglongvec_t',
'delete_unreferenced_stkvars',
'delete_user_cmts_iterator_t',
'delete_user_cmts_t',
@@ -3096,6 +3117,7 @@
'deref_idcv',
'deref_ptr',
'deserialize_tinfo',
'destroy_moddata_merge_handlers',
'detach_action_from_menu',
'detach_action_from_popup',
'detach_action_from_toolbar',
@@ -3322,6 +3344,7 @@
'disown_cfunc_parentee_t',
'disown_chain_visitor_t',
'disown_choose_ioport_parser_t',
'disown_chooser_stdact_desc_t',
'disown_const_aloc_visitor_t',
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
@@ -3336,10 +3359,13 @@
'disown_graph_visitor_t',
'disown_highlighter_cbs_t',
'disown_ioports_fallback_t',
'disown_item_block_locator_t',
'disown_macro_constructor_t',
'disown_merge_node_helper_t',
'disown_microcode_filter_t',
'disown_minsn_visitor_t',
'disown_mlist_mop_visitor_t',
'disown_moddata_diff_helper_t',
'disown_mop_visitor_t',
'disown_optblock_t',
'disown_optinsn_t',
@@ -3439,7 +3465,6 @@
'ea_pointer_cast',
'ea_pointer_frompointer',
'ea_pointer_value',
'ea_to_ea64',
'ea_viewer_history_push_and_jump',
'eamap_begin',
'eamap_clear',
@@ -3750,6 +3775,7 @@
'find_data',
'find_defined',
'find_error',
'find_free_chunk',
'find_free_selector',
'find_func_bounds',
'find_idc_class',
@@ -4438,6 +4464,7 @@
'get_dtype_flag',
'get_dtype_size',
'get_dword',
'get_ea_diffpos_name',
'get_ea_name',
'get_ea_viewer_history_info',
'get_effective_spd',
@@ -4626,7 +4653,6 @@
'get_member_type',
'get_merror_desc',
'get_min_spd_ea',
'get_module_data',
'get_module_info',
'get_mreg_name',
'get_name',
@@ -4666,6 +4692,7 @@
'get_numbered_type',
'get_numbered_type_name',
'get_octet',
'get_octet2',
'get_offbase',
'get_offset_expr',
'get_offset_expression',
@@ -5143,6 +5170,56 @@
'idainfo_xrefnum_set',
'idaplace_t_ea_get',
'idaplace_t_ea_set',
'idbattr_info_t___lt__',
'idbattr_info_t_bitmask_get',
'idbattr_info_t_bitmask_set',
'idbattr_info_t_has_individual_node',
'idbattr_info_t_hashname',
'idbattr_info_t_idi_flags_get',
'idbattr_info_t_idi_flags_set',
'idbattr_info_t_individual_node_get',
'idbattr_info_t_individual_node_set',
'idbattr_info_t_is_bitfield',
'idbattr_info_t_is_bitmap',
'idbattr_info_t_is_boolean',
'idbattr_info_t_is_buf_var',
'idbattr_info_t_is_bytearray',
'idbattr_info_t_is_cstr',
'idbattr_info_t_is_decimal',
'idbattr_info_t_is_hash',
'idbattr_info_t_is_hexadecimal',
'idbattr_info_t_is_incremented',
'idbattr_info_t_is_node_altval',
'idbattr_info_t_is_node_blob',
'idbattr_info_t_is_node_supval',
'idbattr_info_t_is_node_valobj',
'idbattr_info_t_is_node_var',
'idbattr_info_t_is_onoff',
'idbattr_info_t_is_qstring',
'idbattr_info_t_is_readonly_var',
'idbattr_info_t_is_scalar_var',
'idbattr_info_t_is_struc_field',
'idbattr_info_t_is_val_mapped',
'idbattr_info_t_maxsize_get',
'idbattr_info_t_maxsize_set',
'idbattr_info_t_name_get',
'idbattr_info_t_name_set',
'idbattr_info_t_offset_get',
'idbattr_info_t_offset_set',
'idbattr_info_t_ridx',
'idbattr_info_t_str_false',
'idbattr_info_t_str_true',
'idbattr_info_t_tag_get',
'idbattr_info_t_tag_set',
'idbattr_info_t_use_hlpstruc',
'idbattr_info_t_vmap_get',
'idbattr_info_t_vmap_set',
'idbattr_info_t_width_get',
'idbattr_info_t_width_set',
'idbattr_valmap_t_valname_get',
'idbattr_valmap_t_valname_set',
'idbattr_valmap_t_value_get',
'idbattr_valmap_t_value_set',
'idc_get_local_type',
'idc_get_local_type_name',
'idc_get_local_type_raw',
@@ -5796,6 +5873,45 @@
'instant_dbgopts_t_pid_set',
'instant_dbgopts_t_port_get',
'instant_dbgopts_t_port_set',
'int64vec_t___eq__',
'int64vec_t___getitem__',
'int64vec_t___len__',
'int64vec_t___ne__',
'int64vec_t___setitem__',
'int64vec_t__del',
'int64vec_t_add_unique',
'int64vec_t_at',
'int64vec_t_begin',
'int64vec_t_begin__SWIG_0',
'int64vec_t_begin__SWIG_1',
'int64vec_t_capacity',
'int64vec_t_clear',
'int64vec_t_empty',
'int64vec_t_end',
'int64vec_t_end__SWIG_0',
'int64vec_t_end__SWIG_1',
'int64vec_t_erase',
'int64vec_t_erase__SWIG_0',
'int64vec_t_erase__SWIG_1',
'int64vec_t_extract',
'int64vec_t_find',
'int64vec_t_find__SWIG_0',
'int64vec_t_find__SWIG_1',
'int64vec_t_has',
'int64vec_t_inject',
'int64vec_t_insert',
'int64vec_t_pop_back',
'int64vec_t_push_back',
'int64vec_t_push_back__SWIG_0',
'int64vec_t_push_back__SWIG_1',
'int64vec_t_qclear',
'int64vec_t_reserve',
'int64vec_t_resize',
'int64vec_t_resize__SWIG_0',
'int64vec_t_resize__SWIG_1',
'int64vec_t_size',
'int64vec_t_swap',
'int64vec_t_truncate',
'int_pointer_assign',
'int_pointer_cast',
'int_pointer_frompointer',
@@ -5937,6 +6053,7 @@
'is_defarg',
'is_defarg0',
'is_defarg1',
'is_diff_merge_mode',
'is_double',
'is_dummy_member_name',
'is_dword',
@@ -6138,6 +6255,7 @@
'is_usersp',
'is_userti',
'is_valid_cp',
'is_valid_dstate',
'is_valid_trace_file',
'is_valid_typename',
'is_vararg_cc',
@@ -6153,6 +6271,8 @@
'is_yword',
'is_zstroff',
'is_zword',
'item_block_locator_t_get_block_head',
'item_block_locator_t_setup_blocks',
'iterator___eq__',
'iterator___ne__',
'iterator___ref__',
@@ -6365,45 +6485,6 @@
'lock_segm',
'log2ceil',
'log2floor',
'longlongvec_t___eq__',
'longlongvec_t___getitem__',
'longlongvec_t___len__',
'longlongvec_t___ne__',
'longlongvec_t___setitem__',
'longlongvec_t__del',
'longlongvec_t_add_unique',
'longlongvec_t_at',
'longlongvec_t_begin',
'longlongvec_t_begin__SWIG_0',
'longlongvec_t_begin__SWIG_1',
'longlongvec_t_capacity',
'longlongvec_t_clear',
'longlongvec_t_empty',
'longlongvec_t_end',
'longlongvec_t_end__SWIG_0',
'longlongvec_t_end__SWIG_1',
'longlongvec_t_erase',
'longlongvec_t_erase__SWIG_0',
'longlongvec_t_erase__SWIG_1',
'longlongvec_t_extract',
'longlongvec_t_find',
'longlongvec_t_find__SWIG_0',
'longlongvec_t_find__SWIG_1',
'longlongvec_t_has',
'longlongvec_t_inject',
'longlongvec_t_insert',
'longlongvec_t_pop_back',
'longlongvec_t_push_back',
'longlongvec_t_push_back__SWIG_0',
'longlongvec_t_push_back__SWIG_1',
'longlongvec_t_qclear',
'longlongvec_t_reserve',
'longlongvec_t_resize',
'longlongvec_t_resize__SWIG_0',
'longlongvec_t_resize__SWIG_1',
'longlongvec_t_size',
'longlongvec_t_swap',
'longlongvec_t_truncate',
'lookup_key_code',
'lower_type',
'lowertype_helper_t_func_has_stkframe_hole',
@@ -6596,6 +6677,7 @@
'lvar_t_clr_noptr_var',
'lvar_t_clr_notarg',
'lvar_t_clr_overlapped_var',
'lvar_t_clr_shared',
'lvar_t_clr_spoiled_var',
'lvar_t_clr_thisarg',
'lvar_t_clr_unknown_width',
@@ -6630,6 +6712,7 @@
'lvar_t_is_notarg',
'lvar_t_is_overlapped_var',
'lvar_t_is_result_var',
'lvar_t_is_shared',
'lvar_t_is_spoiled_var',
'lvar_t_is_thisarg',
'lvar_t_is_unknown_width',
@@ -6652,6 +6735,7 @@
'lvar_t_set_noptr_var',
'lvar_t_set_notarg',
'lvar_t_set_overlapped_var',
'lvar_t_set_shared',
'lvar_t_set_spoiled_var',
'lvar_t_set_thisarg',
'lvar_t_set_typed',
@@ -6820,6 +6904,7 @@
'mba_t_gotoff_stkvars_set',
'mba_t_graph_insns',
'mba_t_has_bad_sp',
'mba_t_has_outlines',
'mba_t_has_over_chains',
'mba_t_has_passregs',
'mba_t_has_stack_retval',
@@ -7256,6 +7341,78 @@
'memreg_infos_t_size',
'memreg_infos_t_swap',
'memreg_infos_t_truncate',
'merge_data_t_add_event_handler',
'merge_data_t_base_id',
'merge_data_t_compare_merging_tifs',
'merge_data_t_dbctx_ids_get',
'merge_data_t_dbctx_ids_set',
'merge_data_t_ev_handlers_get',
'merge_data_t_ev_handlers_set',
'merge_data_t_get_block_head',
'merge_data_t_has_existing_node',
'merge_data_t_item_block_locator_get',
'merge_data_t_item_block_locator_set',
'merge_data_t_last_udt_related_merger_get',
'merge_data_t_last_udt_related_merger_set',
'merge_data_t_local_id',
'merge_data_t_map_privrange_id',
'merge_data_t_map_tinfo',
'merge_data_t_nbases_get',
'merge_data_t_nbases_set',
'merge_data_t_remote_id',
'merge_data_t_remove_event_handler',
'merge_data_t_set_dbctx_ids',
'merge_data_t_setup_blocks',
'merge_handler_params_t_insert_after_get',
'merge_handler_params_t_insert_after_set',
'merge_handler_params_t_kind_get',
'merge_handler_params_t_kind_set',
'merge_handler_params_t_label_get',
'merge_handler_params_t_label_set',
'merge_handler_params_t_md_get',
'merge_handler_params_t_mh_flags_get',
'merge_handler_params_t_mh_flags_set',
'merge_handler_params_t_ui_complex_details',
'merge_handler_params_t_ui_complex_details__SWIG_0',
'merge_handler_params_t_ui_complex_details__SWIG_1',
'merge_handler_params_t_ui_complex_name',
'merge_handler_params_t_ui_complex_name__SWIG_0',
'merge_handler_params_t_ui_complex_name__SWIG_1',
'merge_handler_params_t_ui_dp_shortname',
'merge_handler_params_t_ui_dp_shortname__SWIG_0',
'merge_handler_params_t_ui_dp_shortname__SWIG_1',
'merge_handler_params_t_ui_has_details',
'merge_handler_params_t_ui_has_details__SWIG_0',
'merge_handler_params_t_ui_has_details__SWIG_1',
'merge_handler_params_t_ui_indent',
'merge_handler_params_t_ui_indent__SWIG_0',
'merge_handler_params_t_ui_indent__SWIG_1',
'merge_handler_params_t_ui_linediff',
'merge_handler_params_t_ui_linediff__SWIG_0',
'merge_handler_params_t_ui_linediff__SWIG_1',
'merge_handler_params_t_ui_split_char',
'merge_handler_params_t_ui_split_char__SWIG_0',
'merge_handler_params_t_ui_split_char__SWIG_1',
'merge_handler_params_t_ui_split_str',
'merge_handler_params_t_ui_split_str__SWIG_0',
'merge_handler_params_t_ui_split_str__SWIG_1',
'merge_node_helper_t_append_eavec',
'merge_node_helper_t_get_column_headers',
'merge_node_helper_t_get_netnode',
'merge_node_helper_t_is_mergeable',
'merge_node_helper_t_map_scalar',
'merge_node_helper_t_map_string',
'merge_node_helper_t_print_entry_details',
'merge_node_helper_t_print_entry_name',
'merge_node_helper_t_refresh',
'merge_node_info_t_name_get',
'merge_node_info_t_name_set',
'merge_node_info_t_nds_flags_get',
'merge_node_info_t_nds_flags_set',
'merge_node_info_t_node_helper_get',
'merge_node_info_t_node_helper_set',
'merge_node_info_t_tag_get',
'merge_node_info_t_tag_set',
'metadata_iterator_t_data_end',
'metadata_iterator_t_data_get',
'metadata_iterator_t_data_set',
@@ -7336,7 +7493,7 @@
'minsn_t_l_set',
'minsn_t_lexcompare',
'minsn_t_may_use_aliased_memory',
'minsn_t_modifes_d',
'minsn_t_modifies_d',
'minsn_t_modifies_pair_mop',
'minsn_t_next_get',
'minsn_t_next_set',
@@ -7425,6 +7582,17 @@
'mnumber_t_update_value',
'mnumber_t_value_get',
'mnumber_t_value_set',
'moddata_diff_helper_t_fields_get',
'moddata_diff_helper_t_fields_set',
'moddata_diff_helper_t_get_struc_ptr',
'moddata_diff_helper_t_merge_ending',
'moddata_diff_helper_t_merge_starting',
'moddata_diff_helper_t_module_name_get',
'moddata_diff_helper_t_module_name_set',
'moddata_diff_helper_t_netnode_name_get',
'moddata_diff_helper_t_netnode_name_set',
'moddata_diff_helper_t_nfields_get',
'moddata_diff_helper_t_nfields_set',
'modify_user_lvar_info',
'modify_user_lvars',
'modinfo_t_base_get',
@@ -7963,6 +8131,7 @@
'new_channel_redir_t',
'new_choose_ioport_parser_t',
'new_chooser_item_attrs_t',
'new_chooser_stdact_desc_t',
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
@@ -8052,7 +8221,6 @@
'new_edge_layout_point_t',
'new_edge_layout_point_t__SWIG_0',
'new_edge_layout_point_t__SWIG_1',
'new_edge_layout_point_t__SWIG_2',
'new_edge_segment_t',
'new_edge_t',
'new_edge_t__SWIG_0',
@@ -8148,6 +8316,8 @@
'new_history_item_t__SWIG_1',
'new_history_t',
'new_ida_lowertype_helper_t',
'new_idbattr_info_t',
'new_idbattr_valmap_t',
'new_idc_global_t',
'new_idc_global_t__SWIG_0',
'new_idc_global_t__SWIG_1',
@@ -8176,6 +8346,9 @@
'new_insn_site_t',
'new_insn_t',
'new_instant_dbgopts_t',
'new_int64vec_t',
'new_int64vec_t__SWIG_0',
'new_int64vec_t__SWIG_1',
'new_int_pointer',
'new_interval_t',
'new_interval_t__SWIG_0',
@@ -8185,6 +8358,7 @@
'new_intvec_t__SWIG_0',
'new_intvec_t__SWIG_1',
'new_ioports_fallback_t',
'new_item_block_locator_t',
'new_iterator',
'new_ivl_t',
'new_ivl_with_name_t',
@@ -8209,9 +8383,6 @@
'new_lochist_t',
'new_lock_func',
'new_lock_segment',
'new_longlongvec_t',
'new_longlongvec_t__SWIG_0',
'new_longlongvec_t__SWIG_1',
'new_lumina_op_res_vec_t',
'new_lumina_op_res_vec_t__SWIG_0',
'new_lumina_op_res_vec_t__SWIG_1',
@@ -8252,6 +8423,9 @@
'new_memreg_infos_t',
'new_memreg_infos_t__SWIG_0',
'new_memreg_infos_t__SWIG_1',
'new_merge_handler_params_t',
'new_merge_node_helper_t',
'new_merge_node_info_t',
'new_metadata_iterator_t',
'new_microcode_filter_t',
'new_minsn_t',
@@ -8264,6 +8438,7 @@
'new_mlist_t__SWIG_1',
'new_mlist_t__SWIG_2',
'new_mnumber_t',
'new_moddata_diff_helper_t',
'new_modinfo_t',
'new_mop_addr_t',
'new_mop_addr_t__SWIG_0',
@@ -8289,6 +8464,7 @@
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_octet_generator_t',
'new_op_parent_info_t',
'new_op_t',
'new_operand_locator_t',
@@ -8422,6 +8598,7 @@
'new_segm_move_info_vec_t__SWIG_0',
'new_segm_move_info_vec_t__SWIG_1',
'new_segm_move_infos_t',
'new_segment_defsr_array',
'new_segment_t',
'new_seh_t',
'new_sel_array',
@@ -8530,12 +8707,12 @@
'new_ui_stroff_ops_t',
'new_ui_stroff_ops_t__SWIG_0',
'new_ui_stroff_ops_t__SWIG_1',
'new_uint64vec_t',
'new_uint64vec_t__SWIG_0',
'new_uint64vec_t__SWIG_1',
'new_uintvec_t',
'new_uintvec_t__SWIG_0',
'new_uintvec_t__SWIG_1',
'new_ulonglongvec_t',
'new_ulonglongvec_t__SWIG_0',
'new_ulonglongvec_t__SWIG_1',
'new_user_cmts_iterator_t',
'new_user_cmts_t',
'new_user_defined_prefix_t',
@@ -8700,6 +8877,15 @@
'number_format_t_type_name_get',
'number_format_t_type_name_set',
'oct_flag',
'octet_generator_t_avail_bits_get',
'octet_generator_t_avail_bits_set',
'octet_generator_t_ea_get',
'octet_generator_t_ea_set',
'octet_generator_t_high_byte_first_get',
'octet_generator_t_high_byte_first_set',
'octet_generator_t_invert_byte_order',
'octet_generator_t_value_get',
'octet_generator_t_value_set',
'off_flag',
'op_adds_xrefs',
'op_bin',
@@ -10291,6 +10477,13 @@
'segm_move_info_vec_t_swap',
'segm_move_info_vec_t_truncate',
'segm_move_infos_t_find',
'segment_defsr_array___getitem__',
'segment_defsr_array___len__',
'segment_defsr_array___setitem__',
'segment_defsr_array__get_bytes',
'segment_defsr_array__set_bytes',
'segment_defsr_array_data_get',
'segment_t___getDefsr',
'segment_t_abits',
'segment_t_abytes',
'segment_t_align_get',
@@ -10481,7 +10674,6 @@
'set_member_name',
'set_member_tinfo',
'set_member_type',
'set_module_data',
'set_name',
'set_nav_colorizer',
'set_node_info',
@@ -10505,6 +10697,7 @@
'set_reg_val',
'set_reg_val__SWIG_0',
'set_reg_val__SWIG_1',
'set_registry_root',
'set_regvar_cmt',
'set_remote_debugger',
'set_resume_mode',
@@ -11690,6 +11883,45 @@
'ui_stroff_ops_t_size',
'ui_stroff_ops_t_swap',
'ui_stroff_ops_t_truncate',
'uint64vec_t___eq__',
'uint64vec_t___getitem__',
'uint64vec_t___len__',
'uint64vec_t___ne__',
'uint64vec_t___setitem__',
'uint64vec_t__del',
'uint64vec_t_add_unique',
'uint64vec_t_at',
'uint64vec_t_begin',
'uint64vec_t_begin__SWIG_0',
'uint64vec_t_begin__SWIG_1',
'uint64vec_t_capacity',
'uint64vec_t_clear',
'uint64vec_t_empty',
'uint64vec_t_end',
'uint64vec_t_end__SWIG_0',
'uint64vec_t_end__SWIG_1',
'uint64vec_t_erase',
'uint64vec_t_erase__SWIG_0',
'uint64vec_t_erase__SWIG_1',
'uint64vec_t_extract',
'uint64vec_t_find',
'uint64vec_t_find__SWIG_0',
'uint64vec_t_find__SWIG_1',
'uint64vec_t_has',
'uint64vec_t_inject',
'uint64vec_t_insert',
'uint64vec_t_pop_back',
'uint64vec_t_push_back',
'uint64vec_t_push_back__SWIG_0',
'uint64vec_t_push_back__SWIG_1',
'uint64vec_t_qclear',
'uint64vec_t_reserve',
'uint64vec_t_resize',
'uint64vec_t_resize__SWIG_0',
'uint64vec_t_resize__SWIG_1',
'uint64vec_t_size',
'uint64vec_t_swap',
'uint64vec_t_truncate',
'uintvec_t___eq__',
'uintvec_t___getitem__',
'uintvec_t___len__',
@@ -11729,45 +11961,6 @@
'uintvec_t_size',
'uintvec_t_swap',
'uintvec_t_truncate',
'ulonglongvec_t___eq__',
'ulonglongvec_t___getitem__',
'ulonglongvec_t___len__',
'ulonglongvec_t___ne__',
'ulonglongvec_t___setitem__',
'ulonglongvec_t__del',
'ulonglongvec_t_add_unique',
'ulonglongvec_t_at',
'ulonglongvec_t_begin',
'ulonglongvec_t_begin__SWIG_0',
'ulonglongvec_t_begin__SWIG_1',
'ulonglongvec_t_capacity',
'ulonglongvec_t_clear',
'ulonglongvec_t_empty',
'ulonglongvec_t_end',
'ulonglongvec_t_end__SWIG_0',
'ulonglongvec_t_end__SWIG_1',
'ulonglongvec_t_erase',
'ulonglongvec_t_erase__SWIG_0',
'ulonglongvec_t_erase__SWIG_1',
'ulonglongvec_t_extract',
'ulonglongvec_t_find',
'ulonglongvec_t_find__SWIG_0',
'ulonglongvec_t_find__SWIG_1',
'ulonglongvec_t_has',
'ulonglongvec_t_inject',
'ulonglongvec_t_insert',
'ulonglongvec_t_pop_back',
'ulonglongvec_t_push_back',
'ulonglongvec_t_push_back__SWIG_0',
'ulonglongvec_t_push_back__SWIG_1',
'ulonglongvec_t_qclear',
'ulonglongvec_t_reserve',
'ulonglongvec_t_resize',
'ulonglongvec_t_resize__SWIG_0',
'ulonglongvec_t_resize__SWIG_1',
'ulonglongvec_t_size',
'ulonglongvec_t_swap',
'ulonglongvec_t_truncate',
'unhide_border',
'unhide_item',
'unmark_selection',
+134 -95
View File
@@ -1925,6 +1925,15 @@
'chooser_item_attrs_t_flags_get',
'chooser_item_attrs_t_flags_set',
'chooser_item_attrs_t_reset',
'chooser_stdact_desc_t_icon_get',
'chooser_stdact_desc_t_icon_set',
'chooser_stdact_desc_t_label_get',
'chooser_stdact_desc_t_label_set',
'chooser_stdact_desc_t_tooltip_get',
'chooser_stdact_desc_t_tooltip_set',
'chooser_stdact_desc_t_ucb',
'chooser_stdact_desc_t_version_get',
'chooser_stdact_desc_t_version_set',
'chunk_size',
'chunk_start',
'cif_t___eq__',
@@ -2132,7 +2141,6 @@
'clr_lzero',
'clr_lzero0',
'clr_lzero1',
'clr_module_data',
'clr_node_info',
'clr_noret',
'clr_notcode',
@@ -2698,6 +2706,7 @@
'delete_channel_redir_t',
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_chooser_stdact_desc_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
@@ -2831,6 +2840,7 @@
'delete_insn_site_t',
'delete_insn_t',
'delete_instant_dbgopts_t',
'delete_int64vec_t',
'delete_int_pointer',
'delete_interval_t',
'delete_intvec_t',
@@ -2850,7 +2860,6 @@
'delete_lochist_t',
'delete_lock_func',
'delete_lock_segment',
'delete_longlongvec_t',
'delete_lowertype_helper_t',
'delete_lumina_client_t',
'delete_lumina_op_res_vec_t',
@@ -2901,6 +2910,7 @@
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_octet_generator_t',
'delete_op_parent_info_t',
'delete_op_t',
'delete_operand_locator_t',
@@ -2979,6 +2989,7 @@
'delete_segm_move_info_t',
'delete_segm_move_info_vec_t',
'delete_segm_move_infos_t',
'delete_segment_defsr_array',
'delete_segment_t',
'delete_seh_t',
'delete_sel_array',
@@ -3050,8 +3061,8 @@
'delete_ui_stroff_applicator_t',
'delete_ui_stroff_op_t',
'delete_ui_stroff_ops_t',
'delete_uint64vec_t',
'delete_uintvec_t',
'delete_ulonglongvec_t',
'delete_unreferenced_stkvars',
'delete_user_cmts_iterator_t',
'delete_user_cmts_t',
@@ -3322,6 +3333,7 @@
'disown_cfunc_parentee_t',
'disown_chain_visitor_t',
'disown_choose_ioport_parser_t',
'disown_chooser_stdact_desc_t',
'disown_const_aloc_visitor_t',
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
@@ -3439,7 +3451,6 @@
'ea_pointer_cast',
'ea_pointer_frompointer',
'ea_pointer_value',
'ea_to_ea64',
'ea_viewer_history_push_and_jump',
'eamap_begin',
'eamap_clear',
@@ -3750,6 +3761,7 @@
'find_data',
'find_defined',
'find_error',
'find_free_chunk',
'find_free_selector',
'find_func_bounds',
'find_idc_class',
@@ -4626,7 +4638,6 @@
'get_member_type',
'get_merror_desc',
'get_min_spd_ea',
'get_module_data',
'get_module_info',
'get_mreg_name',
'get_name',
@@ -4666,6 +4677,7 @@
'get_numbered_type',
'get_numbered_type_name',
'get_octet',
'get_octet2',
'get_offbase',
'get_offset_expr',
'get_offset_expression',
@@ -5796,6 +5808,45 @@
'instant_dbgopts_t_pid_set',
'instant_dbgopts_t_port_get',
'instant_dbgopts_t_port_set',
'int64vec_t___eq__',
'int64vec_t___getitem__',
'int64vec_t___len__',
'int64vec_t___ne__',
'int64vec_t___setitem__',
'int64vec_t__del',
'int64vec_t_add_unique',
'int64vec_t_at',
'int64vec_t_begin',
'int64vec_t_begin__SWIG_0',
'int64vec_t_begin__SWIG_1',
'int64vec_t_capacity',
'int64vec_t_clear',
'int64vec_t_empty',
'int64vec_t_end',
'int64vec_t_end__SWIG_0',
'int64vec_t_end__SWIG_1',
'int64vec_t_erase',
'int64vec_t_erase__SWIG_0',
'int64vec_t_erase__SWIG_1',
'int64vec_t_extract',
'int64vec_t_find',
'int64vec_t_find__SWIG_0',
'int64vec_t_find__SWIG_1',
'int64vec_t_has',
'int64vec_t_inject',
'int64vec_t_insert',
'int64vec_t_pop_back',
'int64vec_t_push_back',
'int64vec_t_push_back__SWIG_0',
'int64vec_t_push_back__SWIG_1',
'int64vec_t_qclear',
'int64vec_t_reserve',
'int64vec_t_resize',
'int64vec_t_resize__SWIG_0',
'int64vec_t_resize__SWIG_1',
'int64vec_t_size',
'int64vec_t_swap',
'int64vec_t_truncate',
'int_pointer_assign',
'int_pointer_cast',
'int_pointer_frompointer',
@@ -6138,6 +6189,7 @@
'is_usersp',
'is_userti',
'is_valid_cp',
'is_valid_dstate',
'is_valid_trace_file',
'is_valid_typename',
'is_vararg_cc',
@@ -6313,7 +6365,7 @@
'loader_input_t_from_capsule',
'loader_input_t_from_fp',
'loader_input_t_from_linput',
'loader_input_t_get_char',
'loader_input_t_get_byte',
'loader_input_t_get_linput',
'loader_input_t_gets',
'loader_input_t_getz',
@@ -6365,45 +6417,6 @@
'lock_segm',
'log2ceil',
'log2floor',
'longlongvec_t___eq__',
'longlongvec_t___getitem__',
'longlongvec_t___len__',
'longlongvec_t___ne__',
'longlongvec_t___setitem__',
'longlongvec_t__del',
'longlongvec_t_add_unique',
'longlongvec_t_at',
'longlongvec_t_begin',
'longlongvec_t_begin__SWIG_0',
'longlongvec_t_begin__SWIG_1',
'longlongvec_t_capacity',
'longlongvec_t_clear',
'longlongvec_t_empty',
'longlongvec_t_end',
'longlongvec_t_end__SWIG_0',
'longlongvec_t_end__SWIG_1',
'longlongvec_t_erase',
'longlongvec_t_erase__SWIG_0',
'longlongvec_t_erase__SWIG_1',
'longlongvec_t_extract',
'longlongvec_t_find',
'longlongvec_t_find__SWIG_0',
'longlongvec_t_find__SWIG_1',
'longlongvec_t_has',
'longlongvec_t_inject',
'longlongvec_t_insert',
'longlongvec_t_pop_back',
'longlongvec_t_push_back',
'longlongvec_t_push_back__SWIG_0',
'longlongvec_t_push_back__SWIG_1',
'longlongvec_t_qclear',
'longlongvec_t_reserve',
'longlongvec_t_resize',
'longlongvec_t_resize__SWIG_0',
'longlongvec_t_resize__SWIG_1',
'longlongvec_t_size',
'longlongvec_t_swap',
'longlongvec_t_truncate',
'lookup_key_code',
'lower_type',
'lowertype_helper_t_func_has_stkframe_hole',
@@ -6596,6 +6609,7 @@
'lvar_t_clr_noptr_var',
'lvar_t_clr_notarg',
'lvar_t_clr_overlapped_var',
'lvar_t_clr_shared',
'lvar_t_clr_spoiled_var',
'lvar_t_clr_thisarg',
'lvar_t_clr_unknown_width',
@@ -6630,6 +6644,7 @@
'lvar_t_is_notarg',
'lvar_t_is_overlapped_var',
'lvar_t_is_result_var',
'lvar_t_is_shared',
'lvar_t_is_spoiled_var',
'lvar_t_is_thisarg',
'lvar_t_is_unknown_width',
@@ -6652,6 +6667,7 @@
'lvar_t_set_noptr_var',
'lvar_t_set_notarg',
'lvar_t_set_overlapped_var',
'lvar_t_set_shared',
'lvar_t_set_spoiled_var',
'lvar_t_set_thisarg',
'lvar_t_set_typed',
@@ -6820,6 +6836,7 @@
'mba_t_gotoff_stkvars_set',
'mba_t_graph_insns',
'mba_t_has_bad_sp',
'mba_t_has_outlines',
'mba_t_has_over_chains',
'mba_t_has_passregs',
'mba_t_has_stack_retval',
@@ -7336,7 +7353,7 @@
'minsn_t_l_set',
'minsn_t_lexcompare',
'minsn_t_may_use_aliased_memory',
'minsn_t_modifes_d',
'minsn_t_modifies_d',
'minsn_t_modifies_pair_mop',
'minsn_t_next_get',
'minsn_t_next_set',
@@ -7827,7 +7844,11 @@
'netnode_supprev',
'netnode_supprev_idx8',
'netnode_supset',
'netnode_supset__SWIG_0',
'netnode_supset__SWIG_1',
'netnode_supset_ea',
'netnode_supset_ea__SWIG_0',
'netnode_supset_ea__SWIG_1',
'netnode_supset_idx8',
'netnode_supshift',
'netnode_supstr',
@@ -7959,6 +7980,7 @@
'new_channel_redir_t',
'new_choose_ioport_parser_t',
'new_chooser_item_attrs_t',
'new_chooser_stdact_desc_t',
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
@@ -8048,7 +8070,6 @@
'new_edge_layout_point_t',
'new_edge_layout_point_t__SWIG_0',
'new_edge_layout_point_t__SWIG_1',
'new_edge_layout_point_t__SWIG_2',
'new_edge_segment_t',
'new_edge_t',
'new_edge_t__SWIG_0',
@@ -8172,6 +8193,9 @@
'new_insn_site_t',
'new_insn_t',
'new_instant_dbgopts_t',
'new_int64vec_t',
'new_int64vec_t__SWIG_0',
'new_int64vec_t__SWIG_1',
'new_int_pointer',
'new_interval_t',
'new_interval_t__SWIG_0',
@@ -8205,9 +8229,6 @@
'new_lochist_t',
'new_lock_func',
'new_lock_segment',
'new_longlongvec_t',
'new_longlongvec_t__SWIG_0',
'new_longlongvec_t__SWIG_1',
'new_lumina_op_res_vec_t',
'new_lumina_op_res_vec_t__SWIG_0',
'new_lumina_op_res_vec_t__SWIG_1',
@@ -8285,6 +8306,7 @@
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_octet_generator_t',
'new_op_parent_info_t',
'new_op_t',
'new_operand_locator_t',
@@ -8418,6 +8440,7 @@
'new_segm_move_info_vec_t__SWIG_0',
'new_segm_move_info_vec_t__SWIG_1',
'new_segm_move_infos_t',
'new_segment_defsr_array',
'new_segment_t',
'new_seh_t',
'new_sel_array',
@@ -8526,12 +8549,12 @@
'new_ui_stroff_ops_t',
'new_ui_stroff_ops_t__SWIG_0',
'new_ui_stroff_ops_t__SWIG_1',
'new_uint64vec_t',
'new_uint64vec_t__SWIG_0',
'new_uint64vec_t__SWIG_1',
'new_uintvec_t',
'new_uintvec_t__SWIG_0',
'new_uintvec_t__SWIG_1',
'new_ulonglongvec_t',
'new_ulonglongvec_t__SWIG_0',
'new_ulonglongvec_t__SWIG_1',
'new_user_cmts_iterator_t',
'new_user_cmts_t',
'new_user_defined_prefix_t',
@@ -8696,6 +8719,15 @@
'number_format_t_type_name_get',
'number_format_t_type_name_set',
'oct_flag',
'octet_generator_t_avail_bits_get',
'octet_generator_t_avail_bits_set',
'octet_generator_t_ea_get',
'octet_generator_t_ea_set',
'octet_generator_t_high_byte_first_get',
'octet_generator_t_high_byte_first_set',
'octet_generator_t_invert_byte_order',
'octet_generator_t_value_get',
'octet_generator_t_value_set',
'off_flag',
'op_adds_xrefs',
'op_bin',
@@ -9305,12 +9337,12 @@
'qfile_t_flush',
'qfile_t_from_capsule',
'qfile_t_from_fp',
'qfile_t_get_char',
'qfile_t_get_byte',
'qfile_t_get_fp',
'qfile_t_gets',
'qfile_t_open',
'qfile_t_opened',
'qfile_t_put_char',
'qfile_t_put_byte',
'qfile_t_puts',
'qfile_t_read',
'qfile_t_readbytes',
@@ -10287,6 +10319,13 @@
'segm_move_info_vec_t_swap',
'segm_move_info_vec_t_truncate',
'segm_move_infos_t_find',
'segment_defsr_array___getitem__',
'segment_defsr_array___len__',
'segment_defsr_array___setitem__',
'segment_defsr_array__get_bytes',
'segment_defsr_array__set_bytes',
'segment_defsr_array_data_get',
'segment_t___getDefsr',
'segment_t_abits',
'segment_t_abytes',
'segment_t_align_get',
@@ -10477,7 +10516,6 @@
'set_member_name',
'set_member_tinfo',
'set_member_type',
'set_module_data',
'set_name',
'set_nav_colorizer',
'set_node_info',
@@ -10501,6 +10539,7 @@
'set_reg_val',
'set_reg_val__SWIG_0',
'set_reg_val__SWIG_1',
'set_registry_root',
'set_regvar_cmt',
'set_remote_debugger',
'set_resume_mode',
@@ -11686,6 +11725,45 @@
'ui_stroff_ops_t_size',
'ui_stroff_ops_t_swap',
'ui_stroff_ops_t_truncate',
'uint64vec_t___eq__',
'uint64vec_t___getitem__',
'uint64vec_t___len__',
'uint64vec_t___ne__',
'uint64vec_t___setitem__',
'uint64vec_t__del',
'uint64vec_t_add_unique',
'uint64vec_t_at',
'uint64vec_t_begin',
'uint64vec_t_begin__SWIG_0',
'uint64vec_t_begin__SWIG_1',
'uint64vec_t_capacity',
'uint64vec_t_clear',
'uint64vec_t_empty',
'uint64vec_t_end',
'uint64vec_t_end__SWIG_0',
'uint64vec_t_end__SWIG_1',
'uint64vec_t_erase',
'uint64vec_t_erase__SWIG_0',
'uint64vec_t_erase__SWIG_1',
'uint64vec_t_extract',
'uint64vec_t_find',
'uint64vec_t_find__SWIG_0',
'uint64vec_t_find__SWIG_1',
'uint64vec_t_has',
'uint64vec_t_inject',
'uint64vec_t_insert',
'uint64vec_t_pop_back',
'uint64vec_t_push_back',
'uint64vec_t_push_back__SWIG_0',
'uint64vec_t_push_back__SWIG_1',
'uint64vec_t_qclear',
'uint64vec_t_reserve',
'uint64vec_t_resize',
'uint64vec_t_resize__SWIG_0',
'uint64vec_t_resize__SWIG_1',
'uint64vec_t_size',
'uint64vec_t_swap',
'uint64vec_t_truncate',
'uintvec_t___eq__',
'uintvec_t___getitem__',
'uintvec_t___len__',
@@ -11725,45 +11803,6 @@
'uintvec_t_size',
'uintvec_t_swap',
'uintvec_t_truncate',
'ulonglongvec_t___eq__',
'ulonglongvec_t___getitem__',
'ulonglongvec_t___len__',
'ulonglongvec_t___ne__',
'ulonglongvec_t___setitem__',
'ulonglongvec_t__del',
'ulonglongvec_t_add_unique',
'ulonglongvec_t_at',
'ulonglongvec_t_begin',
'ulonglongvec_t_begin__SWIG_0',
'ulonglongvec_t_begin__SWIG_1',
'ulonglongvec_t_capacity',
'ulonglongvec_t_clear',
'ulonglongvec_t_empty',
'ulonglongvec_t_end',
'ulonglongvec_t_end__SWIG_0',
'ulonglongvec_t_end__SWIG_1',
'ulonglongvec_t_erase',
'ulonglongvec_t_erase__SWIG_0',
'ulonglongvec_t_erase__SWIG_1',
'ulonglongvec_t_extract',
'ulonglongvec_t_find',
'ulonglongvec_t_find__SWIG_0',
'ulonglongvec_t_find__SWIG_1',
'ulonglongvec_t_has',
'ulonglongvec_t_inject',
'ulonglongvec_t_insert',
'ulonglongvec_t_pop_back',
'ulonglongvec_t_push_back',
'ulonglongvec_t_push_back__SWIG_0',
'ulonglongvec_t_push_back__SWIG_1',
'ulonglongvec_t_qclear',
'ulonglongvec_t_reserve',
'ulonglongvec_t_resize',
'ulonglongvec_t_resize__SWIG_0',
'ulonglongvec_t_resize__SWIG_1',
'ulonglongvec_t_size',
'ulonglongvec_t_swap',
'ulonglongvec_t_truncate',
'unhide_border',
'unhide_item',
'unmark_selection',
+7 -7
View File
@@ -21,19 +21,19 @@ had to build/install it yourself, you will have to specify '--swig-home'.
What follows, are example build commands
### Windows (assume SWiG is installed in C:\swigwin-2.0.12, and IDA is in C:\Program Files\IDA7)
### Windows (assume SWiG is installed in C:\swigwin-4.0.1, and IDA is in C:\Program Files\IDA8)
python2 build.py \\
python3 build.py \\
--with-hexrays \\
--swig-home C:/swigwin-2.0.12 \\
--ida-install "c:/Program\ Files/IDA_7.0-171130-tests"
--swig-home C:/swigwin-4.0.1 \\
--ida-install "c:/Program\ Files/IDA_8.0"
### Linux/OSX (assume SWiG is installed in /opt/swiglinux-2.0.12, and IDA is in /opt/my-ida-install)
### Linux/OSX (assume SWiG is installed in /opt/swiglinux-4.0.1, and IDA is in /opt/my-ida-install)
python2 build.py \\
python3 build.py \\
--with-hexrays \\
--swig-home /opt/swiglinux-2.0.12 \\
--swig-home /opt/swiglinux-4.0.1 \\
--ida-install /opt/my-ida-install
""",
formatter_class=argparse.RawTextHelpFormatter)
+66
View File
@@ -0,0 +1,66 @@
This is an FAQ-style repository of SWiG incantations that are
regularly needed.
# Remove an argument from a prototype (because it doesn't make sense in the context of IDAPython)
%typemap(in,numinputs=0) int length
{
$1 = -1; // always -1 in IDAPython
}
# Add a parameter to a C++ notification
Assume a notification named `struc_renamed`, to which you just
added a `bool success` parameter (to carry along information about the
operation's success so far):
struc_renamed, ///< A structure type has been renamed.
///< \param sptr (::struc_t *)
///< \param success (bool) // <--------- new
That new parameter will be picked up by the hooks-producing code
automatically (great!), which means existing hooks are now broken
(bad.)
We need to add support for calling into "old-style" hooks. That's done
through the `patch_codegen.py` mechanism, and in particular the
`director_method_call_arity_cap` rule. Something like this should do:
"SwigDirector_IDB_Hooks::struc_renamed" : [
("director_method_call_arity_cap", (
False, # add GIL lock
"struc_renamed",
"(method ,(PyObject *)obj0,(__argcnt < 3 ? nullptr : (PyObject *)obj1), nullptr)",
"(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0,(__argcnt < 3 ? nullptr : (PyObject *)obj1), nullptr)")
)),
],
# Handle a virtual method's "output" parameter in a director
Assume you have a virtual method taking an 'output' argument:
void merge_node_helper_t::get_column_headers(qstrvec_t *out, ...)
The neat thing to do here is to let Python implementations do the
following:
def get_column_headers(self, ...):
# ...
return ["Name", "Address"]
To achieve that, you want to use the `directorargout` typemap:
%typemap(directorargout) qstrvec_t * (qstrvec_t tmp)
{ // %typemap(directorargout) qstrvec_t *
if ( PyW_PyListToStrVec(&tmp, $result) >= 0 )
{
$1->swap(tmp);
}
else
{
Swig::DirectorTypeMismatchException::raise(
SWIG_ErrorType(SWIG_TypeError),
"in output value of type 'qstrvec_t' in method '$symname'");
}
}
+2
View File
@@ -25,6 +25,8 @@ def dump_flags(fn):
print(" Thunk function")
if fn.flags & ida_funcs.FUNC_LUMINA:
print(" Function info is provided by Lumina")
if fn.flags & ida_funcs.FUNC_OUTLINE:
print(" Outlined code, not a real function")
def dump_regvars(pfn):
+3 -2
View File
@@ -10,12 +10,13 @@ see_also: show_selected_strings
"""
from __future__ import print_function
import ida_nalt
import idautils
s = idautils.Strings(False)
s.setup(strtypes=Strings.STR_UNICODE | Strings.STR_C)
s.setup(strtypes=[ida_nalt.STRTYPE_C, ida_nalt.STRTYPE_C_16])
for i, v in enumerate(s):
if v is None:
print("Failed to retrieve string index %d" % i)
else:
print("%x: len=%d type=%d index=%d-> '%s'" % (v.ea, v.length, v.type, i, str(v)))
print("%x: len=%d type=0x%x index=%d-> '%s'" % (v.ea, v.length, v.strtype, i, str(v)))
+1 -1
View File
@@ -322,7 +322,7 @@ class idb_logger_hooks_t(ida_idp.IDB_Hooks):
def struc_member_renamed(self, sptr, mptr):
return self._log()
def struc_renamed(self, sptr):
def struc_renamed(self, sptr, success):
return self._log()
def tail_owner_changed(self, tail, owner_func, old_owner):
+168
View File
@@ -68,6 +68,7 @@ the function we are currently looking at.
<ul>
<li>ida_funcs.FUNC_FRAME</li>
<li>ida_funcs.FUNC_LUMINA</li>
<li>ida_funcs.FUNC_OUTLINE</li>
<li>ida_funcs.FUNC_THUNK</li>
<li>ida_funcs.get_fchunk</li>
<li>ida_funcs.is_func_entry</li>
@@ -1155,6 +1156,8 @@ this will not require that the "Strings" window is opened & available.
<li>APIs used
<ul>
<li>ida_nalt.STRTYPE_C</li>
<li>ida_nalt.STRTYPE_C_16</li>
<li>idautils.Strings</li>
</ul>
</li>
@@ -3107,6 +3110,171 @@ We add support for assembling the following pseudo instructions:
</div>
</div>
</div>
<h2>Category: merge</h2>
<div class="c_list" onclick="handle_click()">
<div class="example-entry collapsed-entry" name="py_mex1">
<div>
<span class="exp-col expander">&#x25B9;</span>
<span class="exp-col collapser" style="display:none">&#x25BF;</span>
<a href="merge/py_mex1.py">py_mex1</a>: <i>Add merge functionality to a simple plugin, example 1</i>
</div>
<div class="details" id="DIV_py_mex1">
<pre>
This is a primitive plugin which asks user for some info and saves it for
some addresses.
We will add a merge functionality to plugin.
An IDA plugin may have two kinds of data with permanent storage:
1. Data common for entire database (e.g. the options).
To describe them we will use the idbattr_info_t type.
2. Data specific to a particular address.
To describe them we will use the merge_node_info_t type.
Also, see SDK/plugins/mex1 example
</pre>
<ul>
<li>Category: merge</li>
<li>Summary: Add merge functionality to a simple plugin, example 1</li>
<li>View on <a href="https://github.com/idapython/src/blob/master/examples/merge/py_mex1.py">GitHub</a></li>
<li>Keywords:
IDP_Hooks
plugin
</li>
<li>APIs used
<ul>
<li>ida_funcs.get_func</li>
<li>ida_ida.IDI_ALTVAL</li>
<li>ida_ida.IDI_CSTR</li>
<li>ida_ida.IDI_SCALAR</li>
<li>ida_ida.IDI_SUPVAL</li>
<li>ida_ida.idbattr_info_t</li>
<li>ida_idaapi.BADADDR</li>
<li>ida_idaapi.PLUGIN_MOD</li>
<li>ida_idaapi.PLUGIN_MULTI</li>
<li>ida_idaapi.plugin_t</li>
<li>ida_idaapi.plugmod_t</li>
<li>ida_idp.IDP_Hooks</li>
<li>ida_kernwin.Form</li>
<li>ida_kernwin.Form.ChkGroupControl</li>
<li>ida_kernwin.Form.StringInput</li>
<li>ida_kernwin.get_screen_ea</li>
<li>ida_merge.MERGE_KIND_END</li>
<li>ida_merge.MERGE_KIND_NONE</li>
<li>ida_merge.NDS_IS_STR</li>
<li>ida_merge.NDS_MAP_IDX</li>
<li>ida_merge.merge_handler_params_t</li>
<li>ida_merge.merge_node_info_t</li>
<li>ida_merge.moddata_diff_helper_t</li>
<li>ida_mergemod.create_std_modmerge_handlers</li>
<li>ida_netnode.BADNODE</li>
<li>ida_netnode.SIZEOF_nodeidx_t</li>
<li>ida_netnode.atag</li>
<li>ida_netnode.netnode</li>
<li>ida_netnode.stag</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="example-entry collapsed-entry" name="py_mex3">
<div>
<span class="exp-col expander">&#x25B9;</span>
<span class="exp-col collapser" style="display:none">&#x25BF;</span>
<a href="merge/py_mex3.py">py_mex3</a>: <i>This example uses the mex1 example and improves the user-interface for it.</i>
</div>
<div class="details" id="DIV_py_mex3">
<pre>
IDA Teams uses a chooser to display the merge conflicts.
To fill the chooser columns IDA Teams uses the following methods from diff_source_t type:
* print_diffpos_name()
* print_diffpos_details()
and UI hints from merge_handler_params_t type:
* ui_has_details()
* ui_complex_details()
* ui_complex_name()
In general, chooser columns are filled as following:
columns.clear()
NAME = print_diffpos_name()
if ui_complex_name()
then
columns.add(split NAME by ui_split_char())
else
columns[0] = NAME
if not ui_complex_details()
then
columns.add(print_diffpos_details())
Also, see SDK/plugins/mex3 example
</pre>
<ul>
<li>Category: merge</li>
<li>Summary: This example uses the mex1 example and improves the user-interface for it.</li>
<li>View on <a href="https://github.com/idapython/src/blob/master/examples/merge/py_mex3.py">GitHub</a></li>
<li>Keywords:
IDP_Hooks
plugin
</li>
<li>APIs used
<ul>
<li>ida_funcs.get_func</li>
<li>ida_ida.IDI_ALTVAL</li>
<li>ida_ida.IDI_CSTR</li>
<li>ida_ida.IDI_SCALAR</li>
<li>ida_ida.IDI_SUPVAL</li>
<li>ida_ida.idbattr_info_t</li>
<li>ida_idaapi.BADADDR</li>
<li>ida_idaapi.PLUGIN_MOD</li>
<li>ida_idaapi.PLUGIN_MULTI</li>
<li>ida_idaapi.plugin_t</li>
<li>ida_idaapi.plugmod_t</li>
<li>ida_idp.IDP_Hooks</li>
<li>ida_kernwin.Form</li>
<li>ida_kernwin.Form.ChkGroupControl</li>
<li>ida_kernwin.Form.StringInput</li>
<li>ida_kernwin.get_screen_ea</li>
<li>ida_merge.MERGE_KIND_END</li>
<li>ida_merge.MERGE_KIND_NONE</li>
<li>ida_merge.MH_UI_COLONNAME</li>
<li>ida_merge.MH_UI_COMMANAME</li>
<li>ida_merge.MH_UI_NODETAILS</li>
<li>ida_merge.NDS_IS_STR</li>
<li>ida_merge.NDS_MAP_IDX</li>
<li>ida_merge.create_nodeval_merge_handlers</li>
<li>ida_merge.get_ea_diffpos_name</li>
<li>ida_merge.merge_handler_params_t</li>
<li>ida_merge.merge_node_helper_t</li>
<li>ida_merge.merge_node_info_t</li>
<li>ida_merge.moddata_diff_helper_t</li>
<li>ida_mergemod.create_std_modmerge_handlers</li>
<li>ida_nalt.node2ea</li>
<li>ida_netnode.BADNODE</li>
<li>ida_netnode.SIZEOF_nodeidx_t</li>
<li>ida_netnode.atag</li>
<li>ida_netnode.netnode</li>
<li>ida_netnode.stag</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<h2>Category: pyqt</h2>
<div class="c_list" onclick="handle_click()">
+150
View File
@@ -23,6 +23,7 @@ the function we are currently looking at.
#### Uses
* ida_funcs.FUNC_FRAME
* ida_funcs.FUNC_LUMINA
* ida_funcs.FUNC_OUTLINE
* ida_funcs.FUNC_THUNK
* ida_funcs.get_fchunk
* ida_funcs.is_func_entry
@@ -933,6 +934,8 @@ that are present in the IDB. Contrary to @show_selected_strings,
this will not require that the "Strings" window is opened & available.
#### Uses
* ida_nalt.STRTYPE_C
* ida_nalt.STRTYPE_C_16
* idautils.Strings
#### See also
@@ -2586,6 +2589,153 @@ IDP_Hooks
* ida_idp.IDP_Hooks
* idautils.DecodeInstruction
</blockquote>
</details>
## Category: merge
#### py_mex1
<details>
<summary>Add merge functionality to a simple plugin, example 1</summary>
<blockquote>
#### Source code
<a href="https://github.com/idapython/src/blob/master/examples/merge/py_mex1.py">merge/py_mex1.py</a>
#### Category
merge
#### Description
This is a primitive plugin which asks user for some info and saves it for
some addresses.
We will add a merge functionality to plugin.
An IDA plugin may have two kinds of data with permanent storage:
1. Data common for entire database (e.g. the options).
To describe them we will use the idbattr_info_t type.
2. Data specific to a particular address.
To describe them we will use the merge_node_info_t type.
Also, see SDK/plugins/mex1 example
#### Keywords
IDP_Hooks plugin
#### Uses
* ida_funcs.get_func
* ida_ida.IDI_ALTVAL
* ida_ida.IDI_CSTR
* ida_ida.IDI_SCALAR
* ida_ida.IDI_SUPVAL
* ida_ida.idbattr_info_t
* ida_idaapi.BADADDR
* ida_idaapi.PLUGIN_MOD
* ida_idaapi.PLUGIN_MULTI
* ida_idaapi.plugin_t
* ida_idaapi.plugmod_t
* ida_idp.IDP_Hooks
* ida_kernwin.Form
* ida_kernwin.Form.ChkGroupControl
* ida_kernwin.Form.StringInput
* ida_kernwin.get_screen_ea
* ida_merge.MERGE_KIND_END
* ida_merge.MERGE_KIND_NONE
* ida_merge.NDS_IS_STR
* ida_merge.NDS_MAP_IDX
* ida_merge.merge_handler_params_t
* ida_merge.merge_node_info_t
* ida_merge.moddata_diff_helper_t
* ida_mergemod.create_std_modmerge_handlers
* ida_netnode.BADNODE
* ida_netnode.SIZEOF_nodeidx_t
* ida_netnode.atag
* ida_netnode.netnode
* ida_netnode.stag
</blockquote>
</details>
#### py_mex3
<details>
<summary>This example uses the mex1 example and improves the user-interface for it.</summary>
<blockquote>
#### Source code
<a href="https://github.com/idapython/src/blob/master/examples/merge/py_mex3.py">merge/py_mex3.py</a>
#### Category
merge
#### Description
IDA Teams uses a chooser to display the merge conflicts.
To fill the chooser columns IDA Teams uses the following methods from diff_source_t type:
* print_diffpos_name()
* print_diffpos_details()
and UI hints from merge_handler_params_t type:
* ui_has_details()
* ui_complex_details()
* ui_complex_name()
In general, chooser columns are filled as following:
columns.clear()
NAME = print_diffpos_name()
if ui_complex_name()
then
columns.add(split NAME by ui_split_char())
else
columns[0] = NAME
if not ui_complex_details()
then
columns.add(print_diffpos_details())
Also, see SDK/plugins/mex3 example
#### Keywords
IDP_Hooks plugin
#### Uses
* ida_funcs.get_func
* ida_ida.IDI_ALTVAL
* ida_ida.IDI_CSTR
* ida_ida.IDI_SCALAR
* ida_ida.IDI_SUPVAL
* ida_ida.idbattr_info_t
* ida_idaapi.BADADDR
* ida_idaapi.PLUGIN_MOD
* ida_idaapi.PLUGIN_MULTI
* ida_idaapi.plugin_t
* ida_idaapi.plugmod_t
* ida_idp.IDP_Hooks
* ida_kernwin.Form
* ida_kernwin.Form.ChkGroupControl
* ida_kernwin.Form.StringInput
* ida_kernwin.get_screen_ea
* ida_merge.MERGE_KIND_END
* ida_merge.MERGE_KIND_NONE
* ida_merge.MH_UI_COLONNAME
* ida_merge.MH_UI_COMMANAME
* ida_merge.MH_UI_NODETAILS
* ida_merge.NDS_IS_STR
* ida_merge.NDS_MAP_IDX
* ida_merge.create_nodeval_merge_handlers
* ida_merge.get_ea_diffpos_name
* ida_merge.merge_handler_params_t
* ida_merge.merge_node_helper_t
* ida_merge.merge_node_info_t
* ida_merge.moddata_diff_helper_t
* ida_mergemod.create_std_modmerge_handlers
* ida_nalt.node2ea
* ida_netnode.BADNODE
* ida_netnode.SIZEOF_nodeidx_t
* ida_netnode.atag
* ida_netnode.netnode
* ida_netnode.stag
</blockquote>
</details>
+237
View File
@@ -0,0 +1,237 @@
# pylint: disable=line-too-long,invalid-name,import-error
"""
summary: add merge functionality to a simple plugin, example 1
description:
This is a primitive plugin which asks user for some info and saves it for
some addresses.
We will add a merge functionality to plugin.
An IDA plugin may have two kinds of data with permanent storage:
1. Data common for entire database (e.g. the options).
To describe them we will use the idbattr_info_t type.
2. Data specific to a particular address.
To describe them we will use the merge_node_info_t type.
Also, see SDK/plugins/mex1 example
"""
import ida_idaapi
import ida_ida
import ida_kernwin
import ida_netnode
import ida_funcs
import ida_merge
import ida_mergemod
import ida_idp
# --------------------------------------------------------------------------
class idp_listener_t(ida_idp.IDP_Hooks):
"""
we need an event listener to catch processor_t::ev_create_merge_handlers
"""
def __init__(self, ctx):
# by default IDP_Hooks uses ida_idp.HKCB_GLOBAL hkcb_flags,
# in that case IDP events are sent to all DB instances.
# Such behaviour does not matter for IDA Pro
# but IDA Teams needs to have only one IDP event sent to plugin.
# We set hkcb_flags to 0
ida_idp.IDP_Hooks.__init__(self, 0, 0)
self.ctx = ctx
def ev_ending_undo(self):
"""
A well behaving plugin should restore its state from the database
upon ev_ending_undo. Otherwise its state may be conflicting with the
database.
"""
self.ctx.restore_from_idb()
return 0
def ev_create_merge_handlers(self, md):
"""
This event occurs when IDA is performing a 3-way merge (for IDA Teams)
Our plugins should create and register merge handler(s) for its data.
"""
self.ctx.create_merge_handlers(md)
return 0
# --------------------------------------------------------------------------
# netnode to store plugin data
MEX_NODE_NAME = "$ idapython mex1"
# user input
MEX_OPTION_FLAGS_IDX = ida_idaapi.BADADDR & -1 # atag
MEX_OPTION_IDENT_IDX = ida_idaapi.BADADDR & -2 # stag
# EA marks
MEX_EA_TAG = 'm'
# mex_ctx_t::flags bits
MEX_FLAGS_0 = 0x01
MEX_FLAGS_1 = 0x02
class mex_ctx_t(ida_idaapi.plugmod_t):
"""
Regular plugin implementation below.
For example, in our case the plugin asks for 2 bit values and a string value.
Then the plugin stores this data in the database.
And mark the start address of the current function.
These data will be merged later.
"""
def __init__(self):
# bit flags, see above MEX_FLAGS_0/MEX_FLAGS_1
self.flags = 0
# unique database ident
self.ident = ""
# Restore the plugin data from the database into the memory.
self.restore_from_idb()
# Hook an event listener, to catch the merge-related event(s).
self.idp_listener = idp_listener_t(self)
self.idp_listener.hook()
# MERGE: the following data must exist during plugin lifetime
self.modmerger_helper = None
self.idpopts_info = None
self.merge_node_info = None
def save_to_idb(self):
""" Save the plugin state to the idb. """
nn = ida_netnode.netnode(MEX_NODE_NAME, 0, True)
nn.altset(MEX_OPTION_FLAGS_IDX, self.flags)
nn.supset(MEX_OPTION_IDENT_IDX, self.ident)
def restore_from_idb(self):
""" Restore plugin variables from the idb. """
nn = ida_netnode.netnode(MEX_NODE_NAME)
if nn != ida_netnode.BADNODE:
self.flags = nn.altval(MEX_OPTION_FLAGS_IDX)
self.ident = nn.supstr(MEX_OPTION_IDENT_IDX)
def run(self, _):
"""
Ask user for the data and save them to database.
Add mark for current EA.
"""
if self._ask_form():
self.save_to_idb()
# Our plugin stores a string for the current function.
# Just for illustration purposes of how plugins should merge address-specific info
# stored in a netnode.
ea = ida_kernwin.get_screen_ea()
pfn = ida_funcs.get_func(ea)
if pfn:
one = ""
if (self.flags & MEX_FLAGS_0) != 0:
one = " one"
two = ""
if (self.flags & MEX_FLAGS_1) != 0:
one = " two"
mark = "IPMEX1" + one + two
nn = ida_netnode.netnode(MEX_NODE_NAME, 0, True)
nn.supset_ea(pfn.start_ea, mark, MEX_EA_TAG)
def _ask_form(self):
class MexForm(ida_kernwin.Form):
def __init__(self):
ida_kernwin.Form.__init__(self,
r"""
IDAPython: merge example 1
<Flag 0:{optFlag0}>
<Flag 1:{optFlag1}>{grpFlags}>
<Ident prefix:{ident}>
""",
{
"grpFlags": ida_kernwin.Form.ChkGroupControl(("optFlag0", "optFlag1")),
"ident" : ida_kernwin.Form.StringInput(swidth=10),
})
form = MexForm()
form, _ = form.Compile()
form.grpFlags.value = self.flags
form.ident.value = self.ident
ok = form.Execute()
if ok == 1:
self.flags = form.grpFlags.value
self.ident = form.ident.value
form.Free()
return ok == 1
def create_merge_handlers(self, md):
"""
Create merge handlers for plugin
"""
# 1. Data common for entire database (e.g. the options).
#
# This example shows how to merge the data from database.
# We will describe the items to merge and pass the description
# to create_std_modmerge_handlers(), which will do all the work for us.
sizeof_flags = ida_netnode.SIZEOF_nodeidx_t
self.idpopts_info = [
# Describe both flags
ida_ida.idbattr_info_t("MEX flag 0", MEX_OPTION_FLAGS_IDX, sizeof_flags, MEX_FLAGS_0, ida_netnode.atag, ida_ida.IDI_ALTVAL|ida_ida.IDI_SCALAR),
ida_ida.idbattr_info_t("MEX flag 1", MEX_OPTION_FLAGS_IDX, sizeof_flags, MEX_FLAGS_1, ida_netnode.atag, ida_ida.IDI_ALTVAL|ida_ida.IDI_SCALAR),
# Describe ident
ida_ida.idbattr_info_t("MEX ident", MEX_OPTION_IDENT_IDX, 0, 0, ida_netnode.stag, ida_ida.IDI_SUPVAL|ida_ida.IDI_CSTR),
]
# The descriptions are ready. Now create an instance of the standard helper
# class to be passed to the kernel, and the kernel will take care of organizing
# the merge process for them.
# helper instance name
self.modmerger_helper = ida_merge.moddata_diff_helper_t(
"Sample merge data", # label: prefix for the attribute names, e.g. "Sample merge data.MEX flag 0"
MEX_NODE_NAME, # netnode name for idpopts_info and merge_node_info
self.idpopts_info) # field descriptions
# 2. Data specific to a particular address.
# We describe how the data is stored in a netnode.
self.merge_node_info = [
ida_merge.merge_node_info_t(
"Function marks", # label of the merge handler, e.g. "Plugins/Merge example 1/Function marks"
MEX_EA_TAG, # netnode tag
ida_merge.NDS_MAP_IDX|ida_merge.NDS_IS_STR
# netnode value descriptors and modificators, see \ref nds_flags_t
),
]
# Now we should combine together in function create_std_modmerge_handlers.
# This function will be called on processor_t::ev_create_merge_handlers event.
# As a result, two merge handlers with labels
# "Plugins/Merge example 1/Database attributes"
# "Plugins/Merge example 1/Function marks"
# will be created.
mhp = ida_merge.merge_handler_params_t(
md, # merge handler data
"Plugins/IDAPython merge example 1", # Label of the merge handler
ida_merge.MERGE_KIND_NONE, # allocate a merge kind
ida_merge.MERGE_KIND_END, # insert to the end of handler list
0) # merge handler flags
ida_mergemod.create_std_modmerge_handlers(
mhp,
self.modmerger_helper,
self.merge_node_info)
# --------------------------------------------------------------------------
class mex1_plugin_t(ida_idaapi.plugin_t):
flags = ida_idaapi.PLUGIN_MULTI | ida_idaapi.PLUGIN_MOD
wanted_name = "IDAPython: Merge example 1"
comment = "IDAPython: An example 1 how to implement IDA merge functionality"
wanted_hotkey = ""
help = ""
def init(self):
return mex_ctx_t()
def term(self):
pass
def run(self, arg):
pass
def PLUGIN_ENTRY():
return mex1_plugin_t()
+295
View File
@@ -0,0 +1,295 @@
# pylint: disable=line-too-long,invalid-name,import-error
"""
summary: This example uses the mex1 example and improves the user-interface for it.
description:
IDA Teams uses a chooser to display the merge conflicts.
To fill the chooser columns IDA Teams uses the following methods from diff_source_t type:
* print_diffpos_name()
* print_diffpos_details()
and UI hints from merge_handler_params_t type:
* ui_has_details()
* ui_complex_details()
* ui_complex_name()
In general, chooser columns are filled as following:
columns.clear()
NAME = print_diffpos_name()
if ui_complex_name()
then
columns.add(split NAME by ui_split_char())
else
columns[0] = NAME
if not ui_complex_details()
then
columns.add(print_diffpos_details())
Also, see SDK/plugins/mex3 example
"""
import ida_idaapi
import ida_ida
import ida_kernwin
import ida_netnode
import ida_funcs
import ida_merge
import ida_mergemod
import ida_idp
import ida_nalt
# --------------------------------------------------------------------------
class idp_listener_t(ida_idp.IDP_Hooks):
"""
we need an event listener to catch processor_t::ev_create_merge_handlers
"""
def __init__(self, ctx):
# by default IDP_Hooks uses ida_idp.HKCB_GLOBAL hkcb_flags,
# in that case IDP events are sent to all DB instances.
# Such behaviour does not matter for IDA Pro
# but IDA Teams needs to have only one IDP event sent to plugin.
# We set hkcb_flags to 0
ida_idp.IDP_Hooks.__init__(self, 0, 0)
self.ctx = ctx
def ev_ending_undo(self):
"""
A well behaving plugin should restore its state from the database
upon ev_ending_undo. Otherwise its state may be conflicting with the
database.
"""
self.ctx.restore_from_idb()
return 0
def ev_create_merge_handlers(self, md):
"""
This event occurs when IDA is performing a 3-way merge (for IDA Teams)
Our plugins should create and register merge handler(s) for its data.
"""
self.ctx.create_merge_handlers(md)
return 0
# --------------------------------------------------------------------------
# netnode to store plugin data
MEX_NODE_NAME = "$ idapython mex3"
# user input
MEX_OPTION_FLAGS_IDX = ida_idaapi.BADADDR & -1 # atag
MEX_OPTION_IDENT_IDX = ida_idaapi.BADADDR & -2 # stag
# EA marks
MEX_EA_TAG = 'm'
# mex_ctx_t::flags bits
MEX_FLAGS_0 = 0x01
MEX_FLAGS_1 = 0x02
class mex_ctx_t(ida_idaapi.plugmod_t):
"""
Regular plugin implementation below.
For example, in our case the plugin asks for 2 bit values and a string value.
Then the plugin stores this data in the database.
And mark the start address of the current function.
These data will be merged later.
"""
def __init__(self):
# bit flags, see above MEX_FLAGS_0/MEX_FLAGS_1
self.flags = 0
# unique database ident
self.ident = ""
# Restore the plugin data from the database into the memory.
self.restore_from_idb()
# Hook an event listener, to catch the merge-related event(s).
self.idp_listener = idp_listener_t(self)
self.idp_listener.hook()
# MERGE: the following data must exist during plugin lifetime
self.modmerger_helper = None
self.idpopts_info = None
self.node_helper = None
self.merge_node_info = None
def save_to_idb(self):
""" Save the plugin state to the idb. """
nn = ida_netnode.netnode(MEX_NODE_NAME, 0, True)
nn.altset(MEX_OPTION_FLAGS_IDX, self.flags)
nn.supset(MEX_OPTION_IDENT_IDX, self.ident)
def restore_from_idb(self):
""" Restore plugin variables from the idb. """
nn = ida_netnode.netnode(MEX_NODE_NAME)
if nn != ida_netnode.BADNODE:
self.flags = nn.altval(MEX_OPTION_FLAGS_IDX)
self.ident = nn.supstr(MEX_OPTION_IDENT_IDX)
def run(self, _):
"""
Ask user for the data and save them to database.
Add mark for current EA.
"""
if self._ask_form():
self.save_to_idb()
# Our plugin stores a string for the current function.
# Just for illustration purposes of how plugins should merge address-specific info
# stored in a netnode.
ea = ida_kernwin.get_screen_ea()
pfn = ida_funcs.get_func(ea)
if pfn:
one = ""
if (self.flags & MEX_FLAGS_0) != 0:
one = " one"
two = ""
if (self.flags & MEX_FLAGS_1) != 0:
one = " two"
mark = "IPMEX1" + one + two
nn = ida_netnode.netnode(MEX_NODE_NAME, 0, True)
nn.supset_ea(pfn.start_ea, mark, MEX_EA_TAG)
def _ask_form(self):
class MexForm(ida_kernwin.Form):
def __init__(self):
ida_kernwin.Form.__init__(self,
r"""
IDAPython: merge example 1
<Flag 0:{optFlag0}>
<Flag 1:{optFlag1}>{grpFlags}>
<Ident prefix:{ident}>
""",
{
"grpFlags": ida_kernwin.Form.ChkGroupControl(("optFlag0", "optFlag1")),
"ident" : ida_kernwin.Form.StringInput(swidth=10),
})
form = MexForm()
form, _ = form.Compile()
form.grpFlags.value = self.flags
form.ident.value = self.ident
ok = form.Execute()
if ok == 1:
self.flags = form.grpFlags.value
self.ident = form.ident.value
form.Free()
return ok == 1
def create_merge_handlers(self, md):
"""
Create merge handlers for plugin
"""
#-------------------------------------------------------------------------
# 1. Data common for entire database (e.g. the options).
#
# This example shows how to merge the data from database.
# We will describe the items to merge and pass the description
# to create_std_modmerge_handlers(), which will do all the work for us.
sizeof_flags = ida_netnode.SIZEOF_nodeidx_t
self.idpopts_info = [
# Describe both flags
ida_ida.idbattr_info_t("MEX flag 0", MEX_OPTION_FLAGS_IDX, sizeof_flags, MEX_FLAGS_0, ida_netnode.atag, ida_ida.IDI_ALTVAL|ida_ida.IDI_SCALAR),
ida_ida.idbattr_info_t("MEX flag 1", MEX_OPTION_FLAGS_IDX, sizeof_flags, MEX_FLAGS_1, ida_netnode.atag, ida_ida.IDI_ALTVAL|ida_ida.IDI_SCALAR),
# Describe ident
ida_ida.idbattr_info_t("MEX ident", MEX_OPTION_IDENT_IDX, 0, 0, ida_netnode.stag, ida_ida.IDI_SUPVAL|ida_ida.IDI_CSTR),
]
# The descriptions are ready. Now create an instance of the standard helper
# class to be passed to the kernel, and the kernel will take care of organizing
# the merge process for them.
# helper instance name
self.modmerger_helper = ida_merge.moddata_diff_helper_t(
"Sample merge data", # label: prefix for the attribute names, e.g. "Sample merge data.MEX flag 0"
MEX_NODE_NAME, # netnode name for idpopts_info and merge_node_info
self.idpopts_info) # field descriptions
# Merge handler created from idbattr_info_t with the MH_UI_NODETAILS UI hint.
# Its linear_diff_source_t::get_diffpos_name() method returns NAME constructed as following:
# * prefix if any, f.e. "Sample merge data", concatenated with "."
# * add item name, f.e. "MEX flag 0"
# * add ": "
# * add item value
# You might have noticed this when checking the mex1 and mex2 examples
#
# In this case we can improve UI look if add MH_UI_COLONNAME UI hint to merge_handler_params_t.
#-------------------------------------------------------------------------
# 2. Data specific to a particular address.
#
# To improve UI look for this merge handler we can create a subclass of merge_node_helper_t type.
class node_helper_t(ida_merge.merge_node_helper_t):
def __init__(self):
ida_merge.merge_node_helper_t.__init__(self)
def print_entry_name(self, tag, ndx, _):
""" is called from print_diffpos_name() """
if tag != ord(MEX_EA_TAG):
return ""
# get item value
eanode = ida_netnode.netnode(MEX_NODE_NAME)
ea = ida_nalt.node2ea(ndx)
mark = eanode.supstr_ea(ea, MEX_EA_TAG)
# prepare NAME
ea_nice_name = ida_merge.get_ea_diffpos_name(ea)
return "%s,%s" % (ea_nice_name, mark)
def get_column_headers(self, _1, tag, _2):
""" column headers for chooser """
return ["Address", "Mark"] if tag == ord(MEX_EA_TAG) else []
self.node_helper = node_helper_t()
# We describe how the data is stored in a netnode.
self.merge_node_info = [
ida_merge.merge_node_info_t(
"Function marks", # label of the merge handler, e.g. "Plugins/Merge example 3/Function marks"
MEX_EA_TAG, # netnode tag
ida_merge.NDS_MAP_IDX|ida_merge.NDS_IS_STR,
# netnode value descriptors and modificators, see \ref nds_flags_t
self.node_helper
),
]
#-------------------------------------------------------------------------
# Now we should combine together in function create_merge_handlers.
# This function will be called on processor_t::ev_create_merge_handlers event.
# As a result, two merge handlers with labels
# "Plugins/Merge example 3/Database attributes"
# "Plugins/Merge example 3/Function marks"
# will be created.
mhp = ida_merge.merge_handler_params_t(
md, # merge handler data
"Plugins/IDAPython merge example 3", # Label of the merge handler
ida_merge.MERGE_KIND_NONE, # allocate a merge kind
ida_merge.MERGE_KIND_END, # insert to the end of handler list
ida_merge.MH_UI_COLONNAME) # Create multi-column chooser, split diffpos names using ':'
# create merge handler for idbattr_info_t, it will use MH_UI_COLONNAME.
# MH_UI_COLONNAME will ensure that the diffpos names will be split by ':'
# and displayed as separate columns in a chooser. Multi-column choosers
# are easier to work with for the user.
ida_mergemod.create_std_modmerge_handlers(mhp, self.modmerger_helper)
# create merge handlers for merge_node_info_t, it will use MH_UI_NODETAILS.
mhp.mh_flags = (ida_merge.MH_UI_COMMANAME # Create multi-column chooser, split diffpos names using ','
| ida_merge.MH_UI_NODETAILS) # do not display the detail pane
ida_merge.create_nodeval_merge_handlers(
None,
mhp,
MEX_NODE_NAME,
self.merge_node_info)
# --------------------------------------------------------------------------
class mex3_plugin_t(ida_idaapi.plugin_t):
flags = ida_idaapi.PLUGIN_MULTI | ida_idaapi.PLUGIN_MOD
wanted_name = "IDAPython: Merge example 3"
comment = "IDAPython: An example 1 how to implement IDA merge functionality"
wanted_hotkey = ""
help = ""
def init(self):
return mex_ctx_t()
def term(self):
pass
def run(self, arg):
pass
def PLUGIN_ENTRY():
return mex3_plugin_t()
@@ -112,21 +112,21 @@ class MyGraph(ida_graph.GraphViewer):
def OnGetText(self, node_id):
return self[node_id]
def OnPopup(self, form, popup_handle):
def OnPopup(self, widget, popup_handle):
# graph closer
actname = "graph_closer:%s" % self.title
desc = ida_kernwin.action_desc_t(actname, "Close: %s" % self.title, GraphCloser(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
ida_kernwin.attach_dynamic_action_to_popup(None, popup_handle, desc)
# color changer
actname = "color_changer:%s" % self.title
desc = ida_kernwin.action_desc_t(actname, "Change colors: %s" % self.title, ColorChanger(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
ida_kernwin.attach_dynamic_action_to_popup(None, popup_handle, desc)
# selection printer
actname = "selection_printer:%s" % self.title
desc = ida_kernwin.action_desc_t(actname, "Print selection: %s" % self.title, SelectionPrinter(self))
ida_kernwin.attach_dynamic_action_to_popup(form, popup_handle, desc)
ida_kernwin.attach_dynamic_action_to_popup(None, popup_handle, desc)
def show_graph():
-231
View File
@@ -1,231 +0,0 @@
#ifndef IDAPY_HPP
#define IDAPY_HPP 1
// This set of wrappers lets us keep the typemaps in an acceptable shape.
// Once IDAPython loses support for Python 2.7, these will go.
#ifdef PY3
inline int IDAPyInt_Check(PyObject *obj)
{
return PyLong_Check(obj);
}
inline long IDAPyInt_AsLong(PyObject *io)
{
return PyLong_AsLong(io);
}
inline Py_ssize_t IDAPyInt_AsSsize_t(PyObject *pylong)
{
return PyLong_AsSsize_t(pylong);
}
inline PyObject *IDAPyInt_FromLong(long ival)
{
return PyLong_FromLong(ival);
}
inline int IDAPyIntOrLong_Check(PyObject *obj)
{
return PyLong_Check(obj);
}
inline long IDAPyIntOrLong_AsLong(PyObject *obj)
{
return PyLong_AsLong(obj);
}
inline int IDAPyStr_Check(PyObject *obj)
{
return PyUnicode_Check(obj);
}
inline bool IDAPyStr_AsUTF8(qstring *out, PyObject *obj)
{
PyObject *utf8 = PyUnicode_AsUTF8String(obj);
bool ok = utf8 != nullptr;
if ( ok )
{
char *buffer = nullptr;
Py_ssize_t length = 0;
ok = PyBytes_AsStringAndSize(utf8, &buffer, &length) >= 0;
if ( ok )
{
out->qclear();
out->append(buffer, length);
}
}
Py_XDECREF(utf8);
return ok;
}
inline PyObject *IDAPyStr_FromUTF8(const char *v)
{
return PyUnicode_FromString(v);
}
inline PyObject *IDAPyStr_FromUTF8AndSize(const char *v, Py_ssize_t len)
{
return PyUnicode_FromStringAndSize(v, len);
}
inline int IDAPyBytes_Check(PyObject *obj)
{
return PyBytes_Check(obj);
}
inline int IDAPyBytes_Size(PyObject *obj)
{
return PyBytes_Size(obj);
}
inline PyObject *IDAPyBytes_FromMem(const char *v)
{
return PyBytes_FromString(v);
}
inline PyObject *IDAPyBytes_FromMemAndSize(const char *v, Py_ssize_t len)
{
return PyBytes_FromStringAndSize(v, len);
}
inline int IDAPyBytes_AsMemAndSize(PyObject *obj, char **buffer, Py_ssize_t *length)
{
return PyBytes_AsStringAndSize(obj, buffer, length);
}
inline char *IDAPyBytes_AsString(PyObject *o)
{
return PyBytes_AsString(o);
}
#else
inline int IDAPyInt_Check(PyObject *obj)
{
return PyInt_Check(obj);
}
inline long IDAPyInt_AsLong(PyObject *io)
{
return PyInt_AsLong(io);
}
inline Py_ssize_t IDAPyInt_AsSsize_t(PyObject *pylong)
{
return PyInt_AsSsize_t(pylong);
}
inline PyObject *IDAPyInt_FromLong(long ival)
{
return PyInt_FromLong(ival);
}
inline int IDAPyIntOrLong_Check(PyObject *obj)
{
return PyInt_Check(obj) || PyLong_Check(obj);
}
inline long IDAPyIntOrLong_AsLong(PyObject *obj)
{
return PyInt_Check(obj) ? PyInt_AsLong(obj) : PyLong_AsLong(obj);
}
inline int IDAPyStr_Check(PyObject *obj)
{
return PyString_Check(obj);
}
inline bool IDAPyStr_AsUTF8(qstring *out, PyObject *obj)
{
char *buffer = nullptr;
Py_ssize_t length = 0;
bool ok = PyString_AsStringAndSize(obj, &buffer, &length) >= 0;
if ( ok )
{
out->qclear();
out->append(buffer, length);
}
return ok;
}
inline PyObject *IDAPyStr_FromUTF8(const char *v)
{
return PyString_FromString(v);
}
inline PyObject *IDAPyStr_FromUTF8AndSize(const char *v, Py_ssize_t len)
{
return PyString_FromStringAndSize(v, len);
}
inline int IDAPyBytes_Check(PyObject *obj)
{
return PyString_Check(obj);
}
inline int IDAPyBytes_Size(PyObject *obj)
{
return PyString_Size(obj);
}
inline PyObject *IDAPyBytes_FromMem(const char *v)
{
return PyString_FromString(v);
}
inline PyObject *IDAPyBytes_FromMemAndSize(const char *v, Py_ssize_t len)
{
return PyString_FromStringAndSize(v, len);
}
inline int IDAPyBytes_AsMemAndSize(PyObject *obj, char **buffer, Py_ssize_t *length)
{
return PyString_AsStringAndSize(obj, buffer, length);
}
inline char *IDAPyBytes_AsString(PyObject *o)
{
return PyString_AsString(o);
}
#endif
//-------------------------------------------------------------------------
// common code
//-------------------------------------------------------------------------
inline bool IDAPyBytes_AsBytes(bytevec_t *out, PyObject *obj)
{
char *buffer = nullptr;
Py_ssize_t length = 0;
bool ok = IDAPyBytes_AsMemAndSize(obj, &buffer, &length) >= 0;
if ( ok )
{
out->qclear();
out->append((const uchar *) buffer, length);
}
return ok;
}
inline bool IDAPyBytes_as_qtype(qtype *out, PyObject *obj)
{
bytevec_t bytes;
bool ok = IDAPyBytes_AsBytes(&bytes, obj);
if ( ok )
{
out->qclear();
out->append(bytes.begin(), bytes.size());
}
return ok;
}
inline PyObject *IDAPyStr_FromUTF8(const qstring &s)
{
return IDAPyStr_FromUTF8AndSize(s.c_str(), s.length());
}
#endif // IDAPY_HPP
+14 -62
View File
@@ -28,16 +28,6 @@
#include <kernwin.hpp>
#include <ida_highlighter.hpp>
#include <signal.h>
#if defined (PY_MAJOR_VERSION) && (PY_MAJOR_VERSION < 3)
// in Python 2.x many APIs accept char * instead of const char *
GCC_DIAG_OFF(write-strings)
#endif
#ifdef PY3
# define PYCODE_OBJECT_TO_PYEVAL_ARG(Expr) (Expr)
#else
# define PYCODE_OBJECT_TO_PYEVAL_ARG(Expr) ((PyCodeObject *) Expr)
#endif
#include "pywraps.hpp"
@@ -704,7 +694,7 @@ void convert_idc_args()
char attr_name[20] = { "0" };
for ( int i=1; get_idcv_attr(&attr, idc_args, attr_name) == eOk; i++ )
{
PyList_Insert(py_args.o, i, IDAPyStr_FromUTF8(attr.c_str()));
PyList_Insert(py_args.o, i, PyUnicode_FromString(attr.c_str()));
qsnprintf(attr_name, sizeof(attr_name), "%d", i);
}
}
@@ -743,7 +733,6 @@ static void send_modules_lifecycle_notification(module_lifecycle_notification_t
}
//-------------------------------------------------------------------------
#ifdef PY3
static wchar_t *utf8_wchar_t(qvector<wchar_t> *out, const char *in)
{
#ifdef __NT__
@@ -764,8 +753,6 @@ static wchar_t *utf8_wchar_t(qvector<wchar_t> *out, const char *in)
#endif
return out->begin();
}
#endif // PY3
//-------------------------------------------------------------------------
idapython_plugin_t::idapython_plugin_t()
@@ -944,11 +931,7 @@ bool idapython_plugin_t::init()
if ( lastslash != nullptr )
{
*lastslash = 0;
# ifdef PY3
utf8_wchar_t(&pyhomepath, utf8_pyhomepath);
# else
pyhomepath = utf8_pyhomepath;
# endif
Py_SetPythonHome(pyhomepath.begin());
}
}
@@ -1454,11 +1437,7 @@ bool idapython_plugin_t::_extlang_create_object(
py_res = try_create_swig_wrapper(py_mod, clsname, args[0].pvoid);
if ( py_res != nullptr )
{
#ifdef PY3
PyObject_SetAttrString(py_res.o, S_PY_IDCCVT_ID_ATTR, PyLong_FromLong(PY_ICID_OPAQUE));
#else
PyObject_SetAttrString(py_res.o, S_PY_IDCCVT_ID_ATTR, PyInt_FromLong(PY_ICID_OPAQUE));
#endif
}
else
{
@@ -1512,7 +1491,7 @@ bool idapython_plugin_t::_extlang_eval_snippet(
globals,
globals,
nullptr));
ok = result != nullptr && !PyErr_Occurred();
ok = result != nullptr && !PyErr_Occurred(); //-V560 is always true: !PyErr_Occurred()
if ( !ok )
handle_python_error(errbuf);
}
@@ -1572,21 +1551,12 @@ bool idapython_plugin_t::_extlang_call_func(
borref_t code(extapi.PyFunction_GetCode_ptr(func));
qvector<PyObject*> pargs_ptrs;
pargs.to_pyobject_pointers(&pargs_ptrs);
#ifdef PY3
newref_t py_res(PyEval_EvalCodeEx(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
code.o,
globals, nullptr,
pargs_ptrs.begin(),
nargs,
nullptr, 0, nullptr, 0, nullptr, nullptr));
#else
newref_t py_res(PyEval_EvalCodeEx(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
globals, nullptr,
pargs_ptrs.begin(),
nargs,
nullptr, 0, nullptr, 0, nullptr));
#endif
ok = return_python_result(result, py_res, errbuf);
} while ( false );
@@ -1749,7 +1719,7 @@ bool idapython_plugin_t::_extlang_get_attr(
// Convert name python string to a C string
qstring clsname;
if ( !IDAPyStr_AsUTF8(&clsname, string.o) )
if ( !PyUnicode_as_qstring(&clsname, string.o) )
break;
result->set_string(clsname); //-V595 'result' was utilized before it was verified against nullptr
@@ -1901,11 +1871,7 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
else
{
PyObject *py_globals = _get_module_globals();
newref_t py_result(
PyEval_EvalCode(
PYCODE_OBJECT_TO_PYEVAL_ARG(py_code.o),
py_globals,
py_globals));
newref_t py_result(PyEval_EvalCode(py_code.o, py_globals, py_globals));
if ( py_result == nullptr || PyErr_Occurred() ) //-V560 is always false: PyErr_Occurred()
{
@@ -1925,14 +1891,7 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
if ( PyUnicode_Check(py_result.o) )
{
qstring utf8;
#ifdef PY3
IDAPyStr_AsUTF8(&utf8, py_result.o);
#else
newref_t py_result_utf8(PyUnicode_AsUTF8String(py_result.o));
ok = py_result_utf8 != nullptr;
if ( ok )
IDAPyStr_AsUTF8(&utf8, py_result_utf8.o);
#endif
PyUnicode_as_qstring(&utf8, py_result.o);
msg("%s\n", utf8.c_str());
}
else
@@ -2002,7 +1961,7 @@ bool idapython_plugin_t::_handle_file(
char script[MAXSTR];
qstrncpy(script, path, sizeof(script));
strrpl(script, '\\', '/');
newref_t py_script(IDAPyStr_FromUTF8(script));
newref_t py_script(PyUnicode_FromString(script));
if ( globals == nullptr )
globals = _get_module_globals();
@@ -2012,7 +1971,7 @@ bool idapython_plugin_t::_handle_file(
// should have the '__file__' attribute properly set (so that
// it doesn't just get temporarily set and then removed by
// `ida_idaapi.IDAPython_ExecScript`.
newref_t py_file_key(IDAPyStr_FromUTF8(S_FILE));
newref_t py_file_key(PyUnicode_FromString(S_FILE));
if ( !PyDict_Contains(globals, py_file_key.o) )
PyDict_SetItem(globals, py_file_key.o, py_script.o);
}
@@ -2068,9 +2027,9 @@ bool idapython_plugin_t::_handle_file(
ok = true;
}
}
else if ( IDAPyStr_Check(ret_o) )
else if ( PyUnicode_Check(ret_o) )
{
IDAPyStr_AsUTF8(errbuf, ret_o);
PyUnicode_as_qstring(errbuf, ret_o);
}
else
{
@@ -2140,8 +2099,8 @@ void idapython_plugin_t::_prepare_sys_path()
qstring path_el_utf8;
newref_t path_el(PySequence_GetItem(path.o, i));
if ( path_el != nullptr
&& IDAPyStr_Check(path_el.o) > 0
&& IDAPyStr_AsUTF8(&path_el_utf8, path_el.o) )
&& PyUnicode_Check(path_el.o)
&& PyUnicode_as_qstring(&path_el_utf8, path_el.o) )
{
if ( path_el_utf8.empty() )
continue; // skip empty entry
@@ -2154,12 +2113,8 @@ void idapython_plugin_t::_prepare_sys_path()
if ( !new_path.empty() )
new_path.append(DELIMITER);
new_path.append(idadir("python"));
#ifdef PY3
qvector<wchar_t> wpath;
PySys_SetPath(utf8_wchar_t(&wpath, new_path.c_str()));
#else
PySys_SetPath(new_path.begin());
#endif
}
//-------------------------------------------------------------------------
@@ -2169,7 +2124,7 @@ void idapython_plugin_t::_prepare_sys_path()
bool idapython_plugin_t::_run_init_py()
{
char path[QMAXPATH];
qmakepath(path, MAXSTR, idapython_dir.c_str(), S_INIT_PY, nullptr);
qmakepath(path, sizeof(path), idapython_dir.c_str(), S_INIT_PY, nullptr);
#ifdef __NT__
// if the current disk has no space (sic, the current directory, not the one
@@ -2209,10 +2164,7 @@ bool idapython_plugin_t::_run_init_py()
if ( code == nullptr )
return false;
newref_t result(PyEval_EvalCode(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
__main__globals,
__main__globals));
newref_t result(PyEval_EvalCode(code.o, __main__globals, __main__globals));
return result != nullptr && !PyErr_Occurred();
}
+2
View File
@@ -25,6 +25,8 @@ global:
enable_python_cli;
idapython_hook_to_notification_point;
idapython_unhook_from_notification_point;
idapython_register_hook;
idapython_unregister_hook;
idapython_show_wait_box;
idapython_hide_wait_box;
idcvar_to_pyvar;
+2
View File
@@ -61,6 +61,8 @@ EXPORTS
get_callable_arg_count
idapython_hook_to_notification_point
idapython_unhook_from_notification_point
idapython_register_hook
idapython_unregister_hook
idapython_show_wait_box
idapython_hide_wait_box
register_module_lifecycle_callbacks
-441
View File
@@ -1,441 +0,0 @@
--- !tapi-tbd
tbd-version: 4
targets: [ arm64e-macos ]
install-name: '@executable_path/libpython2.link.dylib'
current-version: 2.7.16
compatibility-version: 2.7
exports:
- targets: [ arm64e-macos ]
symbols: [ _AEDesc_Convert, _AEDesc_New, _AEDesc_NewBorrowed, _BMObj_Convert,
_BMObj_New, _CFArrayRefObj_Convert, _CFArrayRefObj_New, _CFDictionaryRefObj_Convert,
_CFDictionaryRefObj_New, _CFMutableArrayRefObj_Convert, _CFMutableArrayRefObj_New,
_CFMutableDictionaryRefObj_Convert, _CFMutableDictionaryRefObj_New,
_CFMutableStringRefObj_Convert, _CFMutableStringRefObj_New,
_CFObj_Convert, _CFObj_New, _CFStringRefObj_Convert, _CFStringRefObj_New,
_CFTypeRefObj_Convert, _CFTypeRefObj_New, _CFURLRefObj_Convert,
_CFURLRefObj_New, _CmpInstObj_Convert, _CmpInstObj_New, _CmpObj_Convert,
_CmpObj_New, _CtlObj_Convert, _CtlObj_New, _DlgObj_Convert,
_DlgObj_New, _DlgObj_WhichDialog, _DragObj_Convert, _DragObj_New,
_GWorldObj_Convert, _GWorldObj_New, _GrafObj_Convert, _GrafObj_New,
_ListObj_Convert, _ListObj_New, _MenuObj_Convert, _MenuObj_New,
_OptResObj_Convert, _OptResObj_New, _OptionalCFURLRefObj_Convert,
_PyAST_Check, _PyAST_Compile, _PyAST_FromNode, _PyAST_mod2obj,
_PyAST_obj2mod, _PyArena_AddPyObject, _PyArena_Free, _PyArena_Malloc,
_PyArena_New, _PyArg_Parse, _PyArg_ParseTuple, _PyArg_ParseTupleAndKeywords,
_PyArg_UnpackTuple, _PyArg_VaParse, _PyArg_VaParseTupleAndKeywords,
_PyBaseObject_Type, _PyBaseString_Type, _PyBool_FromLong,
_PyBool_Type, _PyBuffer_FillContiguousStrides, _PyBuffer_FillInfo,
_PyBuffer_FromContiguous, _PyBuffer_FromMemory, _PyBuffer_FromObject,
_PyBuffer_FromReadWriteMemory, _PyBuffer_FromReadWriteObject,
_PyBuffer_GetPointer, _PyBuffer_IsContiguous, _PyBuffer_New,
_PyBuffer_Release, _PyBuffer_ToContiguous, _PyBuffer_Type,
_PyByteArrayIter_Type, _PyByteArray_AsString, _PyByteArray_Concat,
_PyByteArray_Fini, _PyByteArray_FromObject, _PyByteArray_FromStringAndSize,
_PyByteArray_Init, _PyByteArray_Resize, _PyByteArray_Size,
_PyByteArray_Type, _PyCFunction_Call, _PyCFunction_ClearFreeList,
_PyCFunction_Fini, _PyCFunction_GetFlags, _PyCFunction_GetFunction,
_PyCFunction_GetSelf, _PyCFunction_New, _PyCFunction_NewEx,
_PyCFunction_Type, _PyCObject_AsVoidPtr, _PyCObject_FromVoidPtr,
_PyCObject_FromVoidPtrAndDesc, _PyCObject_GetDesc, _PyCObject_Import,
_PyCObject_SetVoidPtr, _PyCObject_Type, _PyCallIter_New, _PyCallIter_Type,
_PyCallable_Check, _PyCapsule_GetContext, _PyCapsule_GetDestructor,
_PyCapsule_GetName, _PyCapsule_GetPointer, _PyCapsule_Import,
_PyCapsule_IsValid, _PyCapsule_New, _PyCapsule_SetContext,
_PyCapsule_SetDestructor, _PyCapsule_SetName, _PyCapsule_SetPointer,
_PyCapsule_Type, _PyCell_Get, _PyCell_New, _PyCell_Set, _PyCell_Type,
_PyClassMethod_New, _PyClassMethod_Type, _PyClass_IsSubclass,
_PyClass_New, _PyClass_Type, _PyCode_Addr2Line, _PyCode_New,
_PyCode_NewEmpty, _PyCode_Optimize, _PyCode_Type, _PyCodec_BackslashReplaceErrors,
_PyCodec_Decode, _PyCodec_Decoder, _PyCodec_Encode, _PyCodec_Encoder,
_PyCodec_IgnoreErrors, _PyCodec_IncrementalDecoder, _PyCodec_IncrementalEncoder,
_PyCodec_LookupError, _PyCodec_Register, _PyCodec_RegisterError,
_PyCodec_ReplaceErrors, _PyCodec_StreamReader, _PyCodec_StreamWriter,
_PyCodec_StrictErrors, _PyCodec_XMLCharRefReplaceErrors, _PyComplex_AsCComplex,
_PyComplex_FromCComplex, _PyComplex_FromDoubles, _PyComplex_ImagAsDouble,
_PyComplex_RealAsDouble, _PyComplex_Type, _PyDescr_NewClassMethod,
_PyDescr_NewGetSet, _PyDescr_NewMember, _PyDescr_NewMethod,
_PyDescr_NewWrapper, _PyDictItems_Type, _PyDictIterItem_Type,
_PyDictIterKey_Type, _PyDictIterValue_Type, _PyDictKeys_Type,
_PyDictProxy_New, _PyDictProxy_Type, _PyDictValues_Type, _PyDict_Clear,
_PyDict_Contains, _PyDict_Copy, _PyDict_DelItem, _PyDict_DelItemString,
_PyDict_Fini, _PyDict_GetItem, _PyDict_GetItemString, _PyDict_Items,
_PyDict_Keys, _PyDict_Merge, _PyDict_MergeFromSeq2, _PyDict_New,
_PyDict_Next, _PyDict_SetItem, _PyDict_SetItemString, _PyDict_Size,
_PyDict_Type, _PyDict_Update, _PyDict_Values, _PyEllipsis_Type,
_PyEnum_Type, _PyErr_BadArgument, _PyErr_BadInternalCall,
_PyErr_CheckSignals, _PyErr_Clear, _PyErr_Display, _PyErr_ExceptionMatches,
_PyErr_Fetch, _PyErr_Format, _PyErr_GivenExceptionMatches,
_PyErr_Mac, _PyErr_NewException, _PyErr_NewExceptionWithDoc,
_PyErr_NoMemory, _PyErr_NormalizeException, _PyErr_Occurred,
_PyErr_Print, _PyErr_PrintEx, _PyErr_ProgramText, _PyErr_Restore,
_PyErr_SetFromErrno, _PyErr_SetFromErrnoWithFilename, _PyErr_SetFromErrnoWithFilenameObject,
_PyErr_SetInterrupt, _PyErr_SetNone, _PyErr_SetObject, _PyErr_SetString,
_PyErr_SyntaxLocation, _PyErr_Warn, _PyErr_WarnEx, _PyErr_WarnExplicit,
_PyErr_WriteUnraisable, _PyEval_AcquireLock, _PyEval_AcquireThread,
_PyEval_CallFunction, _PyEval_CallMethod, _PyEval_CallObjectWithKeywords,
_PyEval_EvalCode, _PyEval_EvalCodeEx, _PyEval_EvalFrame, _PyEval_EvalFrameEx,
_PyEval_GetBuiltins, _PyEval_GetCallStats, _PyEval_GetFrame,
_PyEval_GetFuncDesc, _PyEval_GetFuncName, _PyEval_GetGlobals,
_PyEval_GetLocals, _PyEval_GetRestricted, _PyEval_InitThreads,
_PyEval_MergeCompilerFlags, _PyEval_ReInitThreads, _PyEval_ReleaseLock,
_PyEval_ReleaseThread, _PyEval_RestoreThread, _PyEval_SaveThread,
_PyEval_SetProfile, _PyEval_SetTrace, _PyEval_ThreadsInitialized,
_PyExc_ArithmeticError, _PyExc_AssertionError, _PyExc_AttributeError,
_PyExc_BaseException, _PyExc_BufferError, _PyExc_BytesWarning,
_PyExc_DeprecationWarning, _PyExc_EOFError, _PyExc_EnvironmentError,
_PyExc_Exception, _PyExc_FloatingPointError, _PyExc_FutureWarning,
_PyExc_GeneratorExit, _PyExc_IOError, _PyExc_ImportError,
_PyExc_ImportWarning, _PyExc_IndentationError, _PyExc_IndexError,
_PyExc_KeyError, _PyExc_KeyboardInterrupt, _PyExc_LookupError,
_PyExc_MemoryError, _PyExc_MemoryErrorInst, _PyExc_NameError,
_PyExc_NotImplementedError, _PyExc_OSError, _PyExc_OverflowError,
_PyExc_PendingDeprecationWarning, _PyExc_RecursionErrorInst,
_PyExc_ReferenceError, _PyExc_RuntimeError, _PyExc_RuntimeWarning,
_PyExc_StandardError, _PyExc_StopIteration, _PyExc_SyntaxError,
_PyExc_SyntaxWarning, _PyExc_SystemError, _PyExc_SystemExit,
_PyExc_TabError, _PyExc_TypeError, _PyExc_UnboundLocalError,
_PyExc_UnicodeDecodeError, _PyExc_UnicodeEncodeError, _PyExc_UnicodeError,
_PyExc_UnicodeTranslateError, _PyExc_UnicodeWarning, _PyExc_UserWarning,
_PyExc_ValueError, _PyExc_Warning, _PyExc_ZeroDivisionError,
_PyFPE_dummy, _PyFile_AsFile, _PyFile_DecUseCount, _PyFile_FromFile,
_PyFile_FromString, _PyFile_GetLine, _PyFile_IncUseCount,
_PyFile_Name, _PyFile_SetBufSize, _PyFile_SetEncoding, _PyFile_SetEncodingAndErrors,
_PyFile_SoftSpace, _PyFile_Type, _PyFile_WriteObject, _PyFile_WriteString,
_PyFloat_AsDouble, _PyFloat_AsReprString, _PyFloat_AsString,
_PyFloat_ClearFreeList, _PyFloat_Fini, _PyFloat_FromDouble,
_PyFloat_FromString, _PyFloat_GetInfo, _PyFloat_GetMax, _PyFloat_GetMin,
_PyFloat_Type, _PyFrame_BlockPop, _PyFrame_BlockSetup, _PyFrame_ClearFreeList,
_PyFrame_FastToLocals, _PyFrame_Fini, _PyFrame_GetLineNumber,
_PyFrame_LocalsToFast, _PyFrame_New, _PyFrame_Type, _PyFrozenSet_New,
_PyFrozenSet_Type, _PyFunction_GetClosure, _PyFunction_GetCode,
_PyFunction_GetDefaults, _PyFunction_GetGlobals, _PyFunction_GetModule,
_PyFunction_New, _PyFunction_SetClosure, _PyFunction_SetDefaults,
_PyFunction_Type, _PyFuture_FromAST, _PyGC_Collect, _PyGILState_Ensure,
_PyGILState_GetThisThreadState, _PyGILState_Release, _PyGen_NeedsFinalizing,
_PyGen_New, _PyGen_Type, _PyGetSetDescr_Type, _PyGrammar_AddAccelerators,
_PyGrammar_FindDFA, _PyGrammar_LabelRepr, _PyGrammar_RemoveAccelerators,
_PyImport_AddModule, _PyImport_AppendInittab, _PyImport_Cleanup,
_PyImport_ExecCodeModule, _PyImport_ExecCodeModuleEx, _PyImport_ExtendInittab,
_PyImport_FrozenModules, _PyImport_GetImporter, _PyImport_GetMagicNumber,
_PyImport_GetModuleDict, _PyImport_Import, _PyImport_ImportFrozenModule,
_PyImport_ImportModule, _PyImport_ImportModuleLevel, _PyImport_ImportModuleNoBlock,
_PyImport_Inittab, _PyImport_ReloadModule, _PyInstance_New,
_PyInstance_NewRaw, _PyInstance_Type, _PyInt_AsLong, _PyInt_AsSsize_t,
_PyInt_AsUnsignedLongLongMask, _PyInt_AsUnsignedLongMask,
_PyInt_ClearFreeList, _PyInt_Fini, _PyInt_FromLong, _PyInt_FromSize_t,
_PyInt_FromSsize_t, _PyInt_FromString, _PyInt_FromUnicode,
_PyInt_GetMax, _PyInt_Type, _PyInterpreterState_Clear, _PyInterpreterState_Delete,
_PyInterpreterState_Head, _PyInterpreterState_New, _PyInterpreterState_Next,
_PyInterpreterState_ThreadHead, _PyIter_Next, _PyListIter_Type,
_PyListRevIter_Type, _PyList_Append, _PyList_AsTuple, _PyList_Fini,
_PyList_GetItem, _PyList_GetSlice, _PyList_Insert, _PyList_New,
_PyList_Reverse, _PyList_SetItem, _PyList_SetSlice, _PyList_Size,
_PyList_Sort, _PyList_Type, _PyLong_AsDouble, _PyLong_AsLong,
_PyLong_AsLongAndOverflow, _PyLong_AsLongLong, _PyLong_AsLongLongAndOverflow,
_PyLong_AsSsize_t, _PyLong_AsUnsignedLong, _PyLong_AsUnsignedLongLong,
_PyLong_AsUnsignedLongLongMask, _PyLong_AsUnsignedLongMask,
_PyLong_AsVoidPtr, _PyLong_FromDouble, _PyLong_FromLong, _PyLong_FromLongLong,
_PyLong_FromSize_t, _PyLong_FromSsize_t, _PyLong_FromString,
_PyLong_FromUnicode, _PyLong_FromUnsignedLong, _PyLong_FromUnsignedLongLong,
_PyLong_FromVoidPtr, _PyLong_GetInfo, _PyLong_Type, _PyMacGluePtr_AEDesc_Convert,
_PyMacGluePtr_AEDesc_New, _PyMacGluePtr_AEDesc_NewBorrowed,
_PyMacGluePtr_BMObj_Convert, _PyMacGluePtr_BMObj_New, _PyMacGluePtr_CFArrayRefObj_Convert,
_PyMacGluePtr_CFArrayRefObj_New, _PyMacGluePtr_CFDictionaryRefObj_Convert,
_PyMacGluePtr_CFDictionaryRefObj_New, _PyMacGluePtr_CFMutableArrayRefObj_Convert,
_PyMacGluePtr_CFMutableArrayRefObj_New, _PyMacGluePtr_CFMutableDictionaryRefObj_Convert,
_PyMacGluePtr_CFMutableDictionaryRefObj_New, _PyMacGluePtr_CFMutableStringRefObj_Convert,
_PyMacGluePtr_CFMutableStringRefObj_New, _PyMacGluePtr_CFObj_Convert,
_PyMacGluePtr_CFObj_New, _PyMacGluePtr_CFStringRefObj_Convert,
_PyMacGluePtr_CFStringRefObj_New, _PyMacGluePtr_CFTypeRefObj_Convert,
_PyMacGluePtr_CFTypeRefObj_New, _PyMacGluePtr_CFURLRefObj_Convert,
_PyMacGluePtr_CFURLRefObj_New, _PyMacGluePtr_CmpInstObj_Convert,
_PyMacGluePtr_CmpInstObj_New, _PyMacGluePtr_CmpObj_Convert,
_PyMacGluePtr_CmpObj_New, _PyMacGluePtr_CtlObj_Convert, _PyMacGluePtr_CtlObj_New,
_PyMacGluePtr_DlgObj_Convert, _PyMacGluePtr_DlgObj_New, _PyMacGluePtr_DlgObj_WhichDialog,
_PyMacGluePtr_DragObj_Convert, _PyMacGluePtr_DragObj_New,
_PyMacGluePtr_GWorldObj_Convert, _PyMacGluePtr_GWorldObj_New,
_PyMacGluePtr_GrafObj_Convert, _PyMacGluePtr_GrafObj_New,
_PyMacGluePtr_ListObj_Convert, _PyMacGluePtr_ListObj_New,
_PyMacGluePtr_MenuObj_Convert, _PyMacGluePtr_MenuObj_New,
_PyMacGluePtr_OptResObj_Convert, _PyMacGluePtr_OptResObj_New,
_PyMacGluePtr_OptionalCFURLRefObj_Convert, _PyMacGluePtr_PyMac_BuildFSRef,
_PyMacGluePtr_PyMac_BuildFSSpec, _PyMacGluePtr_PyMac_GetFSRef,
_PyMacGluePtr_PyMac_GetFSSpec, _PyMacGluePtr_QdRGB_Convert,
_PyMacGluePtr_QdRGB_New, _PyMacGluePtr_ResObj_Convert, _PyMacGluePtr_ResObj_New,
_PyMacGluePtr_TEObj_Convert, _PyMacGluePtr_TEObj_New, _PyMacGluePtr_WinObj_Convert,
_PyMacGluePtr_WinObj_New, _PyMacGluePtr_WinObj_WhichWindow,
_PyMac_BuildEventRecord, _PyMac_BuildFSRef, _PyMac_BuildFSSpec,
_PyMac_BuildFixed, _PyMac_BuildNumVersion, _PyMac_BuildOSType,
_PyMac_BuildOptStr255, _PyMac_BuildPoint, _PyMac_BuildRect,
_PyMac_BuildStr255, _PyMac_Buildwide, _PyMac_Error, _PyMac_GetEventRecord,
_PyMac_GetFSRef, _PyMac_GetFSSpec, _PyMac_GetFixed, _PyMac_GetOSErrException,
_PyMac_GetOSType, _PyMac_GetPoint, _PyMac_GetRect, _PyMac_GetStr255,
_PyMac_Getwide, _PyMac_OSErrException, _PyMac_StrError, _PyMapping_Check,
_PyMapping_GetItemString, _PyMapping_HasKey, _PyMapping_HasKeyString,
_PyMapping_Length, _PyMapping_SetItemString, _PyMapping_Size,
_PyMarshal_Init, _PyMarshal_ReadLastObjectFromFile, _PyMarshal_ReadLongFromFile,
_PyMarshal_ReadObjectFromFile, _PyMarshal_ReadObjectFromString,
_PyMarshal_ReadShortFromFile, _PyMarshal_WriteLongToFile,
_PyMarshal_WriteObjectToFile, _PyMarshal_WriteObjectToString,
_PyMem_Free, _PyMem_Malloc, _PyMem_Realloc, _PyMemberDescr_Type,
_PyMember_Get, _PyMember_GetOne, _PyMember_Set, _PyMember_SetOne,
_PyMemoryView_FromBuffer, _PyMemoryView_FromObject, _PyMemoryView_GetContiguous,
_PyMemoryView_Type, _PyMethod_Class, _PyMethod_ClearFreeList,
_PyMethod_Fini, _PyMethod_Function, _PyMethod_New, _PyMethod_Self,
_PyMethod_Type, _PyModule_AddIntConstant, _PyModule_AddObject,
_PyModule_AddStringConstant, _PyModule_GetDict, _PyModule_GetFilename,
_PyModule_GetName, _PyModule_GetWarningsModule, _PyModule_New,
_PyModule_Type, _PyNode_AddChild, _PyNode_Compile, _PyNode_Free,
_PyNode_ListTree, _PyNode_New, _PyNullImporter_Type, _PyNumber_Absolute,
_PyNumber_Add, _PyNumber_And, _PyNumber_AsSsize_t, _PyNumber_Check,
_PyNumber_Coerce, _PyNumber_CoerceEx, _PyNumber_Divide, _PyNumber_Divmod,
_PyNumber_Float, _PyNumber_FloorDivide, _PyNumber_InPlaceAdd,
_PyNumber_InPlaceAnd, _PyNumber_InPlaceDivide, _PyNumber_InPlaceFloorDivide,
_PyNumber_InPlaceLshift, _PyNumber_InPlaceMultiply, _PyNumber_InPlaceOr,
_PyNumber_InPlacePower, _PyNumber_InPlaceRemainder, _PyNumber_InPlaceRshift,
_PyNumber_InPlaceSubtract, _PyNumber_InPlaceTrueDivide, _PyNumber_InPlaceXor,
_PyNumber_Index, _PyNumber_Int, _PyNumber_Invert, _PyNumber_Long,
_PyNumber_Lshift, _PyNumber_Multiply, _PyNumber_Negative,
_PyNumber_Or, _PyNumber_Positive, _PyNumber_Power, _PyNumber_Remainder,
_PyNumber_Rshift, _PyNumber_Subtract, _PyNumber_ToBase, _PyNumber_TrueDivide,
_PyNumber_Xor, _PyOS_AfterFork, _PyOS_FiniInterrupts, _PyOS_InitInterrupts,
_PyOS_InputHook, _PyOS_InterruptOccurred, _PyOS_Readline,
_PyOS_ReadlineFunctionPointer, _PyOS_StdioReadline, _PyOS_ascii_atof,
_PyOS_ascii_formatd, _PyOS_ascii_strtod, _PyOS_double_to_string,
_PyOS_getsig, _PyOS_mystricmp, _PyOS_mystrnicmp, _PyOS_setsig,
_PyOS_snprintf, _PyOS_string_to_double, _PyOS_strtol, _PyOS_strtoul,
_PyOS_vsnprintf, _PyObject_AsCharBuffer, _PyObject_AsFileDescriptor,
_PyObject_AsReadBuffer, _PyObject_AsWriteBuffer, _PyObject_Call,
_PyObject_CallFunction, _PyObject_CallFunctionObjArgs, _PyObject_CallMethod,
_PyObject_CallMethodObjArgs, _PyObject_CallObject, _PyObject_CheckReadBuffer,
_PyObject_ClearWeakRefs, _PyObject_Cmp, _PyObject_Compare,
_PyObject_CopyData, _PyObject_DelItem, _PyObject_DelItemString,
_PyObject_Dir, _PyObject_Format, _PyObject_Free, _PyObject_GC_Del,
_PyObject_GC_Track, _PyObject_GC_UnTrack, _PyObject_GenericGetAttr,
_PyObject_GenericSetAttr, _PyObject_GetAttr, _PyObject_GetAttrString,
_PyObject_GetBuffer, _PyObject_GetItem, _PyObject_GetIter,
_PyObject_HasAttr, _PyObject_HasAttrString, _PyObject_Hash,
_PyObject_HashNotImplemented, _PyObject_Init, _PyObject_InitVar,
_PyObject_IsInstance, _PyObject_IsSubclass, _PyObject_IsTrue,
_PyObject_Length, _PyObject_Malloc, _PyObject_Not, _PyObject_Print,
_PyObject_Realloc, _PyObject_Repr, _PyObject_RichCompare,
_PyObject_RichCompareBool, _PyObject_SelfIter, _PyObject_SetAttr,
_PyObject_SetAttrString, _PyObject_SetItem, _PyObject_Size,
_PyObject_Str, _PyObject_Type, _PyObject_Unicode, _PyParser_ASTFromFile,
_PyParser_ASTFromString, _PyParser_AddToken, _PyParser_Delete,
_PyParser_New, _PyParser_ParseFile, _PyParser_ParseFileFlags,
_PyParser_ParseFileFlagsEx, _PyParser_ParseString, _PyParser_ParseStringFlags,
_PyParser_ParseStringFlagsFilename, _PyParser_ParseStringFlagsFilenameEx,
_PyParser_SetError, _PyParser_SimpleParseFile, _PyParser_SimpleParseFileFlags,
_PyParser_SimpleParseString, _PyParser_SimpleParseStringFilename,
_PyParser_SimpleParseStringFlags, _PyParser_SimpleParseStringFlagsFilename,
_PyProperty_Type, _PyRange_Type, _PyReversed_Type, _PyRun_AnyFile,
_PyRun_AnyFileEx, _PyRun_AnyFileExFlags, _PyRun_AnyFileFlags,
_PyRun_File, _PyRun_FileEx, _PyRun_FileExFlags, _PyRun_FileFlags,
_PyRun_InteractiveLoop, _PyRun_InteractiveLoopFlags, _PyRun_InteractiveOne,
_PyRun_InteractiveOneFlags, _PyRun_SimpleFile, _PyRun_SimpleFileEx,
_PyRun_SimpleFileExFlags, _PyRun_SimpleString, _PyRun_SimpleStringFlags,
_PyRun_String, _PyRun_StringFlags, _PySTEntry_Type, _PyST_GetScope,
_PySeqIter_New, _PySeqIter_Type, _PySequence_Check, _PySequence_Concat,
_PySequence_Contains, _PySequence_Count, _PySequence_DelItem,
_PySequence_DelSlice, _PySequence_Fast, _PySequence_GetItem,
_PySequence_GetSlice, _PySequence_In, _PySequence_InPlaceConcat,
_PySequence_InPlaceRepeat, _PySequence_Index, _PySequence_Length,
_PySequence_List, _PySequence_Repeat, _PySequence_SetItem,
_PySequence_SetSlice, _PySequence_Size, _PySequence_Tuple,
_PySet_Add, _PySet_Clear, _PySet_Contains, _PySet_Discard,
_PySet_Fini, _PySet_New, _PySet_Pop, _PySet_Size, _PySet_Type,
_PySignal_SetWakeupFd, _PySlice_GetIndices, _PySlice_GetIndicesEx,
_PySlice_New, _PySlice_Type, _PyStaticMethod_New, _PyStaticMethod_Type,
_PyString_AsDecodedObject, _PyString_AsDecodedString, _PyString_AsEncodedObject,
_PyString_AsEncodedString, _PyString_AsString, _PyString_AsStringAndSize,
_PyString_Concat, _PyString_ConcatAndDel, _PyString_Decode,
_PyString_DecodeEscape, _PyString_Encode, _PyString_Fini,
_PyString_Format, _PyString_FromFormat, _PyString_FromFormatV,
_PyString_FromString, _PyString_FromStringAndSize, _PyString_InternFromString,
_PyString_InternImmortal, _PyString_InternInPlace, _PyString_Repr,
_PyString_Size, _PyString_Type, _PyStructSequence_InitType,
_PyStructSequence_New, _PyStructSequence_UnnamedField, _PySuper_Type,
_PySymtable_Build, _PySymtable_Free, _PySymtable_Lookup, _PySys_AddWarnOption,
_PySys_GetFile, _PySys_GetObject, _PySys_HasWarnOptions, _PySys_ResetWarnOptions,
_PySys_SetArgv, _PySys_SetArgvEx, _PySys_SetObject, _PySys_SetPath,
_PySys_WriteStderr, _PySys_WriteStdout, _PyThreadState_Clear,
_PyThreadState_Delete, _PyThreadState_DeleteCurrent, _PyThreadState_Get,
_PyThreadState_GetDict, _PyThreadState_New, _PyThreadState_Next,
_PyThreadState_SetAsyncExc, _PyThreadState_Swap, _PyThread_ReInitTLS,
_PyThread_acquire_lock, _PyThread_allocate_lock, _PyThread_create_key,
_PyThread_delete_key, _PyThread_delete_key_value, _PyThread_exit_thread,
_PyThread_free_lock, _PyThread_get_key_value, _PyThread_get_stacksize,
_PyThread_get_thread_ident, _PyThread_init_thread, _PyThread_release_lock,
_PyThread_set_key_value, _PyThread_set_stacksize, _PyThread_start_new_thread,
_PyToken_OneChar, _PyToken_ThreeChars, _PyToken_TwoChars,
_PyTokenizer_Free, _PyTokenizer_FromFile, _PyTokenizer_FromString,
_PyTokenizer_Get, _PyTokenizer_RestoreEncoding, _PyTraceBack_Here,
_PyTraceBack_Print, _PyTraceBack_Type, _PyTupleIter_Type,
_PyTuple_ClearFreeList, _PyTuple_Fini, _PyTuple_GetItem, _PyTuple_GetSlice,
_PyTuple_New, _PyTuple_Pack, _PyTuple_SetItem, _PyTuple_Size,
_PyTuple_Type, _PyType_ClearCache, _PyType_GenericAlloc, _PyType_GenericNew,
_PyType_IsSubtype, _PyType_Modified, _PyType_Ready, _PyType_Type,
_PyUnicodeDecodeError_Create, _PyUnicodeDecodeError_GetEncoding,
_PyUnicodeDecodeError_GetEnd, _PyUnicodeDecodeError_GetObject,
_PyUnicodeDecodeError_GetReason, _PyUnicodeDecodeError_GetStart,
_PyUnicodeDecodeError_SetEnd, _PyUnicodeDecodeError_SetReason,
_PyUnicodeDecodeError_SetStart, _PyUnicodeEncodeError_Create,
_PyUnicodeEncodeError_GetEncoding, _PyUnicodeEncodeError_GetEnd,
_PyUnicodeEncodeError_GetObject, _PyUnicodeEncodeError_GetReason,
_PyUnicodeEncodeError_GetStart, _PyUnicodeEncodeError_SetEnd,
_PyUnicodeEncodeError_SetReason, _PyUnicodeEncodeError_SetStart,
_PyUnicodeTranslateError_Create, _PyUnicodeTranslateError_GetEnd,
_PyUnicodeTranslateError_GetObject, _PyUnicodeTranslateError_GetReason,
_PyUnicodeTranslateError_GetStart, _PyUnicodeTranslateError_SetEnd,
_PyUnicodeTranslateError_SetReason, _PyUnicodeTranslateError_SetStart,
_PyUnicodeUCS2_AsASCIIString, _PyUnicodeUCS2_AsCharmapString,
_PyUnicodeUCS2_AsEncodedObject, _PyUnicodeUCS2_AsEncodedString,
_PyUnicodeUCS2_AsLatin1String, _PyUnicodeUCS2_AsRawUnicodeEscapeString,
_PyUnicodeUCS2_AsUTF16String, _PyUnicodeUCS2_AsUTF32String,
_PyUnicodeUCS2_AsUTF8String, _PyUnicodeUCS2_AsUnicode, _PyUnicodeUCS2_AsUnicodeEscapeString,
_PyUnicodeUCS2_AsWideChar, _PyUnicodeUCS2_ClearFreelist, _PyUnicodeUCS2_Compare,
_PyUnicodeUCS2_Concat, _PyUnicodeUCS2_Contains, _PyUnicodeUCS2_Count,
_PyUnicodeUCS2_Decode, _PyUnicodeUCS2_DecodeASCII, _PyUnicodeUCS2_DecodeCharmap,
_PyUnicodeUCS2_DecodeLatin1, _PyUnicodeUCS2_DecodeRawUnicodeEscape,
_PyUnicodeUCS2_DecodeUTF16, _PyUnicodeUCS2_DecodeUTF16Stateful,
_PyUnicodeUCS2_DecodeUTF32, _PyUnicodeUCS2_DecodeUTF32Stateful,
_PyUnicodeUCS2_DecodeUTF8, _PyUnicodeUCS2_DecodeUTF8Stateful,
_PyUnicodeUCS2_DecodeUnicodeEscape, _PyUnicodeUCS2_Encode,
_PyUnicodeUCS2_EncodeASCII, _PyUnicodeUCS2_EncodeCharmap,
_PyUnicodeUCS2_EncodeDecimal, _PyUnicodeUCS2_EncodeLatin1,
_PyUnicodeUCS2_EncodeRawUnicodeEscape, _PyUnicodeUCS2_EncodeUTF16,
_PyUnicodeUCS2_EncodeUTF32, _PyUnicodeUCS2_EncodeUTF8, _PyUnicodeUCS2_EncodeUnicodeEscape,
_PyUnicodeUCS2_Find, _PyUnicodeUCS2_Format, _PyUnicodeUCS2_FromEncodedObject,
_PyUnicodeUCS2_FromFormat, _PyUnicodeUCS2_FromFormatV, _PyUnicodeUCS2_FromObject,
_PyUnicodeUCS2_FromOrdinal, _PyUnicodeUCS2_FromString, _PyUnicodeUCS2_FromStringAndSize,
_PyUnicodeUCS2_FromUnicode, _PyUnicodeUCS2_FromWideChar, _PyUnicodeUCS2_GetDefaultEncoding,
_PyUnicodeUCS2_GetMax, _PyUnicodeUCS2_GetSize, _PyUnicodeUCS2_Join,
_PyUnicodeUCS2_Partition, _PyUnicodeUCS2_RPartition, _PyUnicodeUCS2_RSplit,
_PyUnicodeUCS2_Replace, _PyUnicodeUCS2_Resize, _PyUnicodeUCS2_RichCompare,
_PyUnicodeUCS2_SetDefaultEncoding, _PyUnicodeUCS2_Split, _PyUnicodeUCS2_Splitlines,
_PyUnicodeUCS2_Tailmatch, _PyUnicodeUCS2_Translate, _PyUnicodeUCS2_TranslateCharmap,
_PyUnicode_AsDecodedObject, _PyUnicode_BuildEncodingMap, _PyUnicode_DecodeUTF7,
_PyUnicode_DecodeUTF7Stateful, _PyUnicode_EncodeUTF7, _PyUnicode_Type,
_PyWeakref_GetObject, _PyWeakref_NewProxy, _PyWeakref_NewRef,
_PyWrapperDescr_Type, _PyWrapper_New, _Py_AddPendingCall,
_Py_AtExit, _Py_BuildValue, _Py_BytesWarningFlag, _Py_CompileString,
_Py_CompileStringFlags, _Py_DebugFlag, _Py_DecRef, _Py_DivisionWarningFlag,
_Py_DontWriteBytecodeFlag, _Py_EndInterpreter, _Py_Exit, _Py_FatalError,
_Py_FdIsInteractive, _Py_FileSystemDefaultEncoding, _Py_Finalize,
_Py_FindMethod, _Py_FindMethodInChain, _Py_FlushLine, _Py_FrozenFlag,
_Py_FrozenMain, _Py_GetArgcArgv, _Py_GetBuildInfo, _Py_GetCompiler,
_Py_GetCopyright, _Py_GetExecPrefix, _Py_GetPath, _Py_GetPlatform,
_Py_GetPrefix, _Py_GetProgramFullPath, _Py_GetProgramName,
_Py_GetPythonHome, _Py_GetRecursionLimit, _Py_GetVersion,
_Py_HashRandomizationFlag, _Py_IgnoreEnvironmentFlag, _Py_IncRef,
_Py_InitModule4_64, _Py_Initialize, _Py_InitializeEx, _Py_InspectFlag,
_Py_InteractiveFlag, _Py_IsInitialized, _Py_Main, _Py_MakePendingCalls,
_Py_NewInterpreter, _Py_NoSiteFlag, _Py_NoUserSiteDirectory,
_Py_OptimizeFlag, _Py_Py3kWarningFlag, _Py_ReprEnter, _Py_ReprLeave,
_Py_SetProgramName, _Py_SetPythonHome, _Py_SetRecursionLimit,
_Py_SubversionRevision, _Py_SubversionShortBranch, _Py_SymtableString,
_Py_TabcheckFlag, _Py_UnicodeFlag, _Py_UniversalNewlineFgets,
_Py_UniversalNewlineFread, _Py_UseClassExceptionsFlag, _Py_VaBuildValue,
_Py_VerboseFlag, _Py_meta_grammar, _Py_pgen, _QdRGB_Convert,
_QdRGB_New, _ResObj_Convert, _ResObj_New, _TEObj_Convert,
_TEObj_New, _WinObj_Convert, _WinObj_New, _WinObj_WhichWindow,
__PyArg_NoKeywords, __PyArg_ParseTupleAndKeywords_SizeT, __PyArg_ParseTuple_SizeT,
__PyArg_Parse_SizeT, __PyArg_VaParseTupleAndKeywords_SizeT,
__PyArg_VaParse_SizeT, __PyBuiltin_Init, __PyByteArray_empty_string,
__PyBytes_FormatAdvanced, __PyCode_CheckLineNumber, __PyCode_ConstantKey,
__PyCodecInfo_GetIncrementalDecoder, __PyCodecInfo_GetIncrementalEncoder,
__PyCodec_DecodeText, __PyCodec_EncodeText, __PyCodec_Lookup,
__PyCodec_LookupTextEncoding, __PyComplex_FormatAdvanced,
__PyDict_Contains, __PyDict_DelItemIf, __PyDict_GetItemWithError,
__PyDict_MaybeUntrack, __PyDict_NewPresized, __PyDict_Next,
__PyErr_BadInternalCall, __PyErr_ReplaceException, __PyEval_CallTracing,
__PyEval_SliceIndex, __PyEval_SliceIndexNotNone, __PyExc_Fini,
__PyExc_Init, __PyFile_SanitizeMode, __PyFloat_FormatAdvanced,
__PyFloat_Init, __PyFloat_Pack4, __PyFloat_Pack8, __PyFloat_Unpack4,
__PyFloat_Unpack8, __PyFrame_Init, __PyGC_Dump, __PyGC_generation0,
__PyGILState_Fini, __PyGILState_Init, __PyImportHooks_Init,
__PyImport_AcquireLock, __PyImport_DynLoadFiletab, __PyImport_Filetab,
__PyImport_FindExtension, __PyImport_FindModule, __PyImport_Fini,
__PyImport_FixupExtension, __PyImport_GetDynLoadFunc, __PyImport_Init,
__PyImport_Inittab, __PyImport_IsScript, __PyImport_LoadDynamicModule,
__PyImport_ReInitLock, __PyImport_ReleaseLock, __PyInstance_Lookup,
__PyInt_AsInt, __PyInt_Format, __PyInt_FormatAdvanced, __PyInt_FromGid,
__PyInt_FromUid, __PyInt_Init, __PyList_Extend, __PyLong_AsByteArray,
__PyLong_AsInt, __PyLong_Copy, __PyLong_DigitValue, __PyLong_Format,
__PyLong_FormatAdvanced, __PyLong_Frexp, __PyLong_FromByteArray,
__PyLong_Init, __PyLong_New, __PyLong_NumBits, __PyLong_Sign,
__PyModule_Clear, __PyNode_SizeOf, __PyNumber_ConvertIntegralToInt,
__PyOS_GetOpt, __PyOS_ReadlineTState, __PyOS_ResetGetOpt,
__PyOS_URandom, __PyOS_ascii_formatd, __PyOS_ascii_strtod,
__PyOS_mystrnicmp_hack, __PyOS_optarg, __PyOS_opterr, __PyOS_optind,
__PyObject_CallFunction_SizeT, __PyObject_CallMethod_SizeT,
__PyObject_Del, __PyObject_Dump, __PyObject_GC_Del, __PyObject_GC_Malloc,
__PyObject_GC_New, __PyObject_GC_NewVar, __PyObject_GC_Resize,
__PyObject_GC_Track, __PyObject_GC_UnTrack, __PyObject_GenericGetAttrWithDict,
__PyObject_GenericSetAttrWithDict, __PyObject_GetDictPtr,
__PyObject_LengthHint, __PyObject_LookupSpecial, __PyObject_New,
__PyObject_NewVar, __PyObject_NextNotImplemented, __PyObject_RealIsInstance,
__PyObject_RealIsSubclass, __PyObject_SlotCompare, __PyObject_Str,
__PyParser_Grammar, __PyParser_TokenNames, __PyRandom_Fini,
__PyRandom_Init, __PySequence_IterSearch, __PySet_Next, __PySet_NextEntry,
__PySet_Update, __PySlice_AdjustIndices, __PySlice_FromIndices,
__PySlice_Unpack, __PyString_Eq, __PyString_FormatLong, __PyString_InsertThousandsGrouping,
__PyString_Join, __PyString_Resize, __PySys_GetSizeOf, __PySys_Init,
__PyThreadState_Current, __PyThreadState_GetFrame, __PyThreadState_Init,
__PyThreadState_Prealloc, __PyThread_CurrentFrames, __PyTrash_delete_later,
__PyTrash_delete_nesting, __PyTrash_deposit_object, __PyTrash_destroy_chain,
__PyTrash_thread_deposit_object, __PyTrash_thread_destroy_chain,
__PyTuple_MaybeUntrack, __PyTuple_Resize, __PyType_Lookup,
__PyUnicodeUCS2_AsDefaultEncodedString, __PyUnicodeUCS2_Fini,
__PyUnicodeUCS2_Init, __PyUnicodeUCS2_IsAlpha, __PyUnicodeUCS2_IsDecimalDigit,
__PyUnicodeUCS2_IsDigit, __PyUnicodeUCS2_IsLinebreak, __PyUnicodeUCS2_IsLowercase,
__PyUnicodeUCS2_IsNumeric, __PyUnicodeUCS2_IsTitlecase, __PyUnicodeUCS2_IsUppercase,
__PyUnicodeUCS2_IsWhitespace, __PyUnicodeUCS2_ToDecimalDigit,
__PyUnicodeUCS2_ToDigit, __PyUnicodeUCS2_ToLowercase, __PyUnicodeUCS2_ToNumeric,
__PyUnicodeUCS2_ToTitlecase, __PyUnicodeUCS2_ToUppercase,
__PyUnicode_DecodeUnicodeInternal, __PyUnicode_FormatAdvanced,
__PyUnicode_TypeRecords, __PyUnicode_XStrip, __PyWarnings_Init,
__PyWeakref_CallableProxyType, __PyWeakref_ClearRef, __PyWeakref_GetWeakrefCount,
__PyWeakref_ProxyType, __PyWeakref_RefType, __Py_Assert, __Py_Assign,
__Py_Attribute, __Py_AugAssign, __Py_BinOp, __Py_BoolOp, __Py_Break,
__Py_BuildValue_SizeT, __Py_Call, __Py_CheckInterval, __Py_CheckRecursionLimit,
__Py_CheckRecursiveCall, __Py_ClassDef, __Py_Compare, __Py_Continue,
__Py_Delete, __Py_Dict, __Py_DictComp, __Py_DisplaySourceLine,
__Py_Ellipsis, __Py_EllipsisObject, __Py_ExceptHandler, __Py_Exec,
__Py_Expr, __Py_Expression, __Py_ExtSlice, __Py_For, __Py_FunctionDef,
__Py_GeneratorExp, __Py_Gid_Converter, __Py_Global, __Py_HashDouble,
__Py_HashPointer, __Py_HashSecret, __Py_If, __Py_IfExp, __Py_Import,
__Py_ImportFrom, __Py_Index, __Py_InsertThousandsGroupingLocale,
__Py_Interactive, __Py_Lambda, __Py_List, __Py_ListComp, __Py_Mangle,
__Py_Module, __Py_Name, __Py_NoneStruct, __Py_NotImplementedStruct,
__Py_Num, __Py_PackageContext, __Py_Pass, __Py_Print, __Py_QnewFlag,
__Py_Raise, __Py_ReadyTypes, __Py_ReleaseInternedStrings,
__Py_Repr, __Py_Return, __Py_Set, __Py_SetComp, __Py_Slice,
__Py_Str, __Py_Subscript, __Py_Suite, __Py_SwappedOp, __Py_Ticker,
__Py_TrueStruct, __Py_TryExcept, __Py_TryFinally, __Py_Tuple,
__Py_Uid_Converter, __Py_UnaryOp, __Py_VaBuildValue_SizeT,
__Py_While, __Py_With, __Py_Yield, __Py_ZeroStruct, __Py_abstract_hack,
__Py_add_one_to_index_C, __Py_add_one_to_index_F, __Py_addarc,
__Py_addbit, __Py_adddfa, __Py_addfirstsets, __Py_addlabel,
__Py_addstate, __Py_alias, __Py_arguments, __Py_ascii_whitespace,
__Py_bytes_capitalize, __Py_bytes_isalnum, __Py_bytes_isalpha,
__Py_bytes_isdigit, __Py_bytes_islower, __Py_bytes_isspace,
__Py_bytes_istitle, __Py_bytes_isupper, __Py_bytes_lower,
__Py_bytes_swapcase, __Py_bytes_title, __Py_bytes_upper, __Py_c_abs,
__Py_c_diff, __Py_c_neg, __Py_c_pow, __Py_c_prod, __Py_c_quot,
__Py_c_sum, __Py_capitalize__doc__, __Py_capsule_hack, __Py_cobject_hack,
__Py_comprehension, __Py_ctype_table, __Py_ctype_tolower,
__Py_ctype_toupper, __Py_delbitset, __Py_dg_dtoa, __Py_dg_freedtoa,
__Py_dg_strtod, __Py_double_round, __Py_findlabel, __Py_freegrammar,
__Py_gitidentifier, __Py_gitversion, __Py_isalnum__doc__,
__Py_isalpha__doc__, __Py_isdigit__doc__, __Py_islower__doc__,
__Py_isspace__doc__, __Py_istitle__doc__, __Py_isupper__doc__,
__Py_keyword, __Py_lower__doc__, __Py_mergebitset, __Py_meta_grammar,
__Py_newbitset, __Py_newgrammar, __Py_parse_inf_or_nan, __Py_pgen,
__Py_samebitset, __Py_swapcase__doc__, __Py_title__doc__,
__Py_translatelabels, __Py_upper__doc__, _asdl_int_seq_new,
_asdl_seq_new, _init_ast, _init_codecs, _init_sre, _init_symtable,
_init_weakref, _initerrno, _initgc, _initimp, _initposix,
_initpwd, _initsignal, _initthread, _initxxsubtype, _initzipimport ]
...
+94 -110
View File
@@ -1,10 +1,4 @@
ifeq ($(PYTHON_VERSION_MAJOR),2)
OBJDIR=obj/$(SYSDIR)/2
else
OBJDIR=obj/$(SYSDIR)/3
endif
include ../../allmake.mak
#----------------------------------------------------------------------
@@ -78,18 +72,10 @@ CONFIGS += idapython.cfg
#----------------------------------------------------------------------
# the 'modules' target is in $(IDA)module.mak
ifeq ($(PYTHON_VERSION_MAJOR),3)
ifdef __EA64__
MODULE_NAME_STEM:=idapython3_
else
MODULE_NAME_STEM:=idapython3
endif
ifdef __EA64__
MODULE_NAME_STEM:=idapython3_
else
ifdef __EA64__
MODULE_NAME_STEM:=idapython2_
else
MODULE_NAME_STEM:=idapython2
endif
MODULE_NAME_STEM:=idapython3
endif
MODULE = $(call module_dll,$(MODULE_NAME_STEM))
MODULES += $(MODULE)
@@ -105,14 +91,12 @@ else
# to hold any libpython3.Y<modifiers>.so<suffix>. Therefore, at
# build-time, let's use our tool (which will in turn use patchelf)
# to expand the DT_NEEDED 'slot' size.
ifeq ($(PYTHON_VERSION_MAJOR),3)
IDAPYSWITCH_MODULE_DEP := $(IDAPYSWITCH_DEP)
ifndef __CODE_CHECKER__
# this is for idapython[64].so
POSTACTION=$(Q)$(IDAPYSWITCH_PATH) --split-debug-and-expand-libpython3-dtneeded-room $(MODULE)
# and this for _ida_*.so
POSTACTION_IDA_X_SO=$(Q)$(IDAPYSWITCH_PATH) --split-debug-and-expand-libpython3-dtneeded-room
endif
IDAPYSWITCH_MODULE_DEP := $(IDAPYSWITCH_DEP)
ifndef __CODE_CHECKER__
# this is for idapython[64].so
POSTACTION=$(Q)$(IDAPYSWITCH_PATH) --split-debug-and-expand-libpython3-dtneeded-room $(MODULE)
# and this for _ida_*.so
POSTACTION_IDA_X_SO=$(Q)$(IDAPYSWITCH_PATH) --split-debug-and-expand-libpython3-dtneeded-room
endif
endif
endif
@@ -121,12 +105,9 @@ endif
ifdef __APPLE_SILICON__
# set up a stub .tbd library to link against, see tbd.readme
TBD_FILE = libpython$(PYTHON_VERSION_MAJOR).tbd
# note: this path must be compatible with -L$(R) -lpython(2|3) in pyplg.mak
# note: this path must be compatible with -L$(R) -lpython3 in pyplg.mak
TBD_MODULE_DEP = $(R)$(TBD_FILE)
# idapyswitch must be told that we're working with Python2
ifeq ($(PYTHON_VERSION_MAJOR),2)
TBD_IDAPYSWITCH_ARGS = --use-python2
endif
endif
#----------------------------------------------------------------------
@@ -226,14 +207,9 @@ else
endif
ST_SDK_TARGETS = $(SDK_SOURCES:$(IDA_INCLUDE)/%=$(ST_SDK)/%)
# Python 2-3
ifeq ($(PYTHON_VERSION_MAJOR),3)
_SWIGPY3FLAG := -py3 -py3-stable-abi -DPY3=1
CC_DEFS += PY3=1
CC_DEFS += Py_LIMITED_API=0x03040000 # we should make sure we use the same version as SWiG
else
USE_PYTHON2_ENVVAR := USE_PYTHON2=1
endif
_SWIGPY3FLAG := -py3 -py3-stable-abi -DPY3=1
CC_DEFS += PY3=1
CC_DEFS += Py_LIMITED_API=0x03040000 # we should make sure we use the same version as SWiG
DYNLOAD_SUBDIR := python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)
DEPLOY_LIBDIR=$(DEPLOY_PYDIR)/ida_$(ADRSIZE)
@@ -248,14 +224,27 @@ ifneq ($(HAS_HEXRAYS),)
WITH_HEXRAYS_DEF = WITH_HEXRAYS
WITH_HEXRAYS_CHKAPI=--with-hexrays
HEXRAYS_MODNAME=hexrays
CMP_API = 1
# Warning: adding an empty HEXRAYS_MODNAME will lead to idaapy trying to load
# a module called ida_.
MODULES_NAMES += $(HEXRAYS_MODNAME)
endif
ifeq ($(CMP_API),)
ifeq ($(OUT_OF_TREE_BUILD),)
ifndef NOTEAMS
HAS_MERGE=1
endif
else
ifneq (,$(wildcard $(IDA_INCLUDE)/merge.hpp))
HAS_MERGE=1
endif
endif
ifeq ($(HAS_HEXRAYS),)
NO_CMP_API := 1
else
ifeq ($(HAS_MERGE),)
NO_CMP_API := 1
endif
endif
#----------------------------------------------------------------------
@@ -306,6 +295,10 @@ MODULES_NAMES += tryblks
MODULES_NAMES += typeinf
MODULES_NAMES += ua
MODULES_NAMES += xref
ifneq ($(HAS_MERGE),)
MODULES_NAMES += mergemod
MODULES_NAMES += merge
endif
ALL_ST_WRAP_CPP = $(foreach mod,$(MODULES_NAMES),$(ST_WRAP)/$(mod).cpp)
ALL_ST_WRAP_PY = $(foreach mod,$(MODULES_NAMES),$(ST_WRAP)/ida_$(mod).py)
@@ -345,6 +338,9 @@ endif
# types will not interfere or clash with the types in your module.
DEF_TYPE_TABLE = SWIG_TYPE_TABLE=idaapi
SWIGFLAGS=$(_SWIGFLAGS) -Itools/typemaps-supplement $(SWIG_INCLUDES) $(addprefix -D,$(DEF_TYPE_TABLE)) -DMISSED_BC695
ifeq ($(HAS_MERGE),)
SWIGFLAGS += -DNOTEAMS
endif
pyfiles: $(DEPLOY_IDAUTILS_PY) \
$(DEPLOY_IDC_PY) \
@@ -373,83 +369,68 @@ ifeq ($(OUT_OF_TREE_BUILD),)
SIP_PYDLL_FNAME:=sip$(PYDLL_EXT)
SIP_PYI_FNAME:=sip.pyi
ifeq ($(PYTHON_VERSION_MAJOR),3)
# sip for Python < 3.8
DEST_SIP34_DIR:=$(DEST_PYQT_DIR)/python_3.4
$(DEST_SIP34_DIR):
# sip for Python < 3.8
DEST_SIP34_DIR:=$(DEST_PYQT_DIR)/python_3.4
$(DEST_SIP34_DIR):
-$(Q)if [ ! -d "$(DEST_SIP34_DIR)" ] ; then mkdir -p 2>/dev/null $(DEST_SIP34_DIR) ; fi
DEST_SIP34_PYDLL:=$(DEST_SIP34_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP34_PYI:=$(DEST_SIP34_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP34_PYDLL): $(wildcard $(SIP34_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP34_DIR)
DEST_SIP34_PYDLL:=$(DEST_SIP34_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP34_PYI:=$(DEST_SIP34_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP34_PYDLL): $(wildcard $(SIP34_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP34_DIR)
$(Q)$(CP) $? $@
$(DEST_SIP34_PYI): $(wildcard $(SIP34_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP34_DIR)
$(DEST_SIP34_PYI): $(wildcard $(SIP34_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP34_DIR)
$(Q)$(CP) $? $@
DEST_SIP += $(DEST_SIP34_PYDLL) $(DEST_SIP34_PYI)
DEST_SIP += $(DEST_SIP34_PYDLL) $(DEST_SIP34_PYI)
# sip for Python [3.8, 3.9)
DEST_SIP38_DIR:=$(DEST_PYQT_DIR)/python_3.8
$(DEST_SIP38_DIR):
# sip for Python [3.8, 3.9)
DEST_SIP38_DIR:=$(DEST_PYQT_DIR)/python_3.8
$(DEST_SIP38_DIR):
-$(Q)if [ ! -d "$(DEST_SIP38_DIR)" ] ; then mkdir -p 2>/dev/null $(DEST_SIP38_DIR) ; fi
DEST_SIP38_PYDLL:=$(DEST_SIP38_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP38_PYI:=$(DEST_SIP38_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP38_PYDLL): $(wildcard $(SIP38_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP38_DIR)
DEST_SIP38_PYDLL:=$(DEST_SIP38_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP38_PYI:=$(DEST_SIP38_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP38_PYDLL): $(wildcard $(SIP38_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP38_DIR)
$(Q)$(CP) $? $@
$(DEST_SIP38_PYI): $(wildcard $(SIP38_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP38_DIR)
$(DEST_SIP38_PYI): $(wildcard $(SIP38_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP38_DIR)
$(Q)$(CP) $? $@
DEST_SIP += $(DEST_SIP38_PYDLL) $(DEST_SIP38_PYI)
DEST_SIP += $(DEST_SIP38_PYDLL) $(DEST_SIP38_PYI)
# sip for Python [3.9, ...
DEST_SIP39_DIR:=$(DEST_PYQT_DIR)/python_3.9
$(DEST_SIP39_DIR):
# sip for Python [3.9, ...
DEST_SIP39_DIR:=$(DEST_PYQT_DIR)/python_3.9
$(DEST_SIP39_DIR):
-$(Q)if [ ! -d "$(DEST_SIP39_DIR)" ] ; then mkdir -p 2>/dev/null $(DEST_SIP39_DIR) ; fi
DEST_SIP39_PYDLL:=$(DEST_SIP39_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP39_PYI:=$(DEST_SIP39_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP39_PYDLL): $(wildcard $(SIP39_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP39_DIR)
DEST_SIP39_PYDLL:=$(DEST_SIP39_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP39_PYI:=$(DEST_SIP39_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP39_PYDLL): $(wildcard $(SIP39_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP39_DIR)
$(Q)$(CP) $? $@
$(DEST_SIP39_PYI): $(wildcard $(SIP39_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP39_DIR)
$(DEST_SIP39_PYI): $(wildcard $(SIP39_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP39_DIR)
$(Q)$(CP) $? $@
DEST_SIP += $(DEST_SIP39_PYDLL) $(DEST_SIP39_PYI)
DEST_SIP += $(DEST_SIP39_PYDLL) $(DEST_SIP39_PYI)
# sip for Python [3.10, ...
DEST_SIP310_DIR:=$(DEST_PYQT_DIR)/python_3.10
$(DEST_SIP310_DIR):
# sip for Python [3.10, ...
DEST_SIP310_DIR:=$(DEST_PYQT_DIR)/python_3.10
$(DEST_SIP310_DIR):
-$(Q)if [ ! -d "$(DEST_SIP310_DIR)" ] ; then mkdir -p 2>/dev/null $(DEST_SIP310_DIR) ; fi
DEST_SIP310_PYDLL:=$(DEST_SIP310_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP310_PYI:=$(DEST_SIP310_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP310_PYDLL): $(wildcard $(SIP310_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP310_DIR)
DEST_SIP310_PYDLL:=$(DEST_SIP310_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP310_PYI:=$(DEST_SIP310_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP310_PYDLL): $(wildcard $(SIP310_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP310_DIR)
$(Q)$(CP) $? $@
$(DEST_SIP310_PYI): $(wildcard $(SIP310_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP310_DIR)
$(DEST_SIP310_PYI): $(wildcard $(SIP310_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP310_DIR)
$(Q)$(CP) $? $@
DEST_SIP += $(DEST_SIP310_PYDLL) $(DEST_SIP310_PYI)
else
# sip for Python 2.7
DEST_SIP27_DIR:=$(DEST_PYQT_DIR)
DEST_SIP27_PYDLL:=$(DEST_SIP27_DIR)/$(SIP_PYDLL_FNAME)
DEST_SIP27_PYI:=$(DEST_SIP27_DIR)/$(SIP_PYI_FNAME)
$(DEST_SIP27_PYDLL): $(wildcard $(SIP27_TREE)/lib/python*/PyQt5/$(SIP_PYDLL_FNAME)) | $(DEST_SIP27_DIR)
$(Q)$(CP) $? $@
$(DEST_SIP27_PYI): $(wildcard $(SIP27_TREE)/lib/python*/PyQt5/$(SIP_PYI_FNAME)) | $(DEST_SIP27_DIR)
$(Q)$(CP) $? $@
DEST_SIP += $(DEST_SIP27_PYDLL) $(DEST_SIP27_PYI)
endif
DEST_SIP += $(DEST_SIP310_PYDLL) $(DEST_SIP310_PYI)
# And pick the right sip.so now (Python3 only; for Python2, we already put it in the right place)
ifeq ($(PYTHON_VERSION_MAJOR),3)
ifeq ($(shell test $(PYTHON_VERSION_MINOR) -gt 8; echo $$?),0) # ugh
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP39_PYDLL)
ifeq ($(shell test $(PYTHON_VERSION_MINOR) -gt 8; echo $$?),0) # ugh
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP39_PYDLL)
else
ifeq ($(shell test $(PYTHON_VERSION_MINOR) -gt 7; echo $$?),0) # ugh
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP38_PYDLL)
else
ifeq ($(shell test $(PYTHON_VERSION_MINOR) -gt 7; echo $$?),0) # ugh
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP38_PYDLL)
else
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP34_PYDLL)
endif
DEST_INSTALL_SIP_PYDLL:=$(DEST_SIP34_PYDLL)
endif
$(DEST_PYQT_DIR)/$(SIP_PYDLL_FNAME): $(DEST_INSTALL_SIP_PYDLL)
endif
$(DEST_PYQT_DIR)/$(SIP_PYDLL_FNAME): $(DEST_INSTALL_SIP_PYDLL)
$(Q)$(CP) $? $@
$(Q)chmod +w $@
DEST_SIP += $(DEST_PYQT_DIR)/$(SIP_PYDLL_FNAME)
endif
DEST_SIP += $(DEST_PYQT_DIR)/$(SIP_PYDLL_FNAME)
endif
pyqt: $(DEST_PYQT)
@@ -490,7 +471,7 @@ $(PARSED_HEADERS_MARKER): $(ST_SDK_TARGETS) $(ST_PARSED_HEADERS_CONFIG) $(ST_SDK
ifeq ($(OUT_OF_TREE_BUILD),)
$(Q)( cat $(ST_PARSED_HEADERS_CONFIG); echo "OUTPUT_DIRECTORY=$(ST_PARSED_HEADERS_NOXML)" ) | $(DOXYGEN_BIN) - >/dev/null
else
(cd $(F) && unzip ../../../out_of_tree/parsed_notifications.zip)
(cd $(F) && unzip ../../out_of_tree/parsed_notifications.zip)
endif
$(Q)touch $@
@@ -776,6 +757,7 @@ ifdef __NT__
$(X_O): CFLAGS += /wd4296 /wd4647 /wd4700 /wd4706
endif
# disable -fno-rtti
$(X_O): pywraps.hpp
$(X_O): NORTTI =
$(X_O): CC_DEFS += PLUGIN_SUBMODULE
$(X_O): CC_DEFS += SWIG_DIRECTOR_NORTTI
@@ -789,7 +771,7 @@ _IDA_X_SO = $(addprefix $(F)_ida_,$(addsuffix $(PYDLL_EXT),$(MODULES_NAMES)))
ifdef __NT__
$(_IDA_X_SO): STDLIBS += user32.lib
endif
# Note: On Windows, IDAPython's python.lib must come *after* python27.lib
# Note: On Windows, IDAPython's python.lib must come *after* python3x.lib
# in the linking command line, otherwise Python will misdetect
# IDAPython's python.dll as the main "python" DLL, and IDAPython
# will fail to load with the following error:
@@ -805,44 +787,46 @@ ifdef __NT__
$(Q)$(RM) $(@:$(PYDLL_EXT)=.exp) $(@:$(PYDLL_EXT)=.lib)
endif
# ../../bin/x64_linux_gcc/python/2/ida_32/_ida_X.so
# ../../bin/x64_linux_gcc/python/ida_32/_ida_X.so
$(DEPLOY_LIBDIR)/_ida_%$(PYDLL_EXT): $(F)_ida_%$(PYDLL_EXT)
$(Q)$(CP) $< $@
ifdef __LINUX__
ifndef __CODE_CHECKER__
ifeq ($(PYTHON_VERSION_MAJOR),3)
$(Q)$(POSTACTION_IDA_X_SO) $@
endif
endif
endif
#----------------------------------------------------------------------
ifdef TESTABLE_BUILD
API_CONTENTS = api_contents$(PYTHON_VERSION_MAJOR).txt
API_CONTENTS = api_contents$(EXTRASUF1)$(PYTHON_VERSION_MAJOR).txt
else
API_CONTENTS = release_api_contents$(PYTHON_VERSION_MAJOR).txt
API_CONTENTS = release_api_contents$(EXTRASUF1)$(PYTHON_VERSION_MAJOR).txt
endif
ST_API_CONTENTS = $(F)$(API_CONTENTS)
.PRECIOUS: $(ST_API_CONTENTS)
api_contents: $(ST_API_CONTENTS)
$(ST_API_CONTENTS): $(ALL_ST_WRAP_CPP)
ifeq ($(or $(__CODE_CHECKER__),$(NO_CMP_API),$(__ASAN__),$(IDAHOME),$(DEMO_OR_FREE)),)
$(QCHKAPI)$(PYTHON) tools/chkapi.py $(WITH_HEXRAYS_CHKAPI) -i $(subst $(space),$(comma),$(ALL_ST_WRAP_CPP)) -p $(subst $(space),$(comma),$(ALL_ST_WRAP_PY)) -r $(ST_API_CONTENTS)
ifeq ($(OUT_OF_TREE_BUILD),)
ifdef CMP_API # turn off comparison when bw-compat is off, or api_contents will differ
ifeq ($(OUT_OF_TREE_BUILD),)
ifdef CMP_API # turn off comparison when bw-compat is off, or api_contents will differ
$(Q)(diff -w $(API_CONTENTS) $(ST_API_CONTENTS)) > /dev/null || \
(echo "API CONTENTS CHANGED! update $(API_CONTENTS) or fix the API" && \
echo "(New API: $(ST_API_CONTENTS)) ***" && \
(diff -U 1 -w $(API_CONTENTS) $(ST_API_CONTENTS) && false))
endif
endif
else
$(Q)touch $@
endif
#----------------------------------------------------------------------
# Check that doc injection is stable
ifdef TESTABLE_BUILD
PYDOC_INJECTIONS = pydoc_injections$(PYTHON_VERSION_MAJOR).txt
PYDOC_INJECTIONS = pydoc_injections$(EXTRASUF1)$(PYTHON_VERSION_MAJOR).txt
else
PYDOC_INJECTIONS = release_pydoc_injections$(PYTHON_VERSION_MAJOR).txt
PYDOC_INJECTIONS = release_pydoc_injections$(EXTRASUF1)$(PYTHON_VERSION_MAJOR).txt
endif
ST_PYDOC_INJECTIONS = $(F)$(PYDOC_INJECTIONS)
.PRECIOUS: $(ST_PYDOC_INJECTIONS)
@@ -853,7 +837,7 @@ else
DUMPDOC_IS_64:=False
endif
PYDOC_INJECTIONS_IDAT_CMD=$(USE_PYTHON2_ENVVAR) $(IDAT_CMD) $(BATCH_SWITCH) -S"$< $@ $(ST_WRAP) $(DUMPDOC_IS_64)" -t -L$(F)dumpdoc.log >/dev/null
PYDOC_INJECTIONS_IDAT_CMD=$(IDAT_CMD) $(BATCH_SWITCH) -S"$< $@ $(ST_WRAP) $(DUMPDOC_IS_64)" -t -L$(F)dumpdoc.log >/dev/null
pydoc_injections: $(ST_PYDOC_INJECTIONS)
$(ST_PYDOC_INJECTIONS): tools/dumpdoc.py $(IDAPYTHON_MODULES) $(PYTHON_BINARY_MODULES)
ifeq ($(or $(__CODE_CHECKER__),$(NO_CMP_API),$(__ASAN__),$(IDAHOME),$(DEMO_OR_FREE)),)
@@ -899,7 +883,7 @@ ifneq ($(wildcard ../../tests),)
endif
#----------------------------------------------------------------------
PUBTREE_DIR=$(F)/public_tree
PUBTREE_DIR=$(F)public_tree
public_tree: all
ifeq ($(OUT_OF_TREE_BUILD),)
-$(Q)if [ ! -d "$(PUBTREE_DIR)/out_of_tree" ] ; then mkdir -p 2>/dev/null $(PUBTREE_DIR)/out_of_tree ; fi
@@ -911,7 +895,7 @@ ifeq ($(OUT_OF_TREE_BUILD),)
--exclude=docs/hr-html/ \
--exclude=**/*~ \
. $(PUBTREE_DIR)
(cd $(F) && zip -r ../../../$(PUBTREE_DIR)/out_of_tree/parsed_notifications.zip parsed_notifications)
(cd $(F) && zip -r ../../$(PUBTREE_DIR)/out_of_tree/parsed_notifications.zip parsed_notifications)
endif
#----------------------------------------------------------------------
@@ -1075,5 +1059,5 @@ $(F)idapython$(O): $(I)bitrange.hpp $(I)bytes.hpp $(I)config.hpp \
$(I)ieee.h $(I)kernwin.hpp $(I)lines.hpp $(I)llong.hpp \
$(I)loader.hpp $(I)nalt.hpp $(I)name.hpp $(I)netnode.hpp \
$(I)pro.h $(I)range.hpp $(I)segment.hpp $(I)typeinf.hpp \
$(I)ua.hpp $(I)xref.hpp extapi.cpp extapi.hpp idapy.hpp \
$(I)ua.hpp $(I)xref.hpp extapi.cpp extapi.hpp \
idapython.cpp pywraps.cpp pywraps.hpp
Binary file not shown.
+1909 -309
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+10 -29
View File
@@ -35,18 +35,6 @@ import types
import os
import sys
# TO_REFACTOR_ON_PY2_REMOVAL
# this internal function can be dropped
def refs(ea, funcfirst, funcnext):
"""
Generic reference collector - INTERNAL USE ONLY.
"""
ref = funcfirst(ea)
while ref != ida_idaapi.BADADDR:
yield ref
ref = funcnext(ea, ref)
def CodeRefsTo(ea, flow):
"""
Get a list of code references to 'ea'
@@ -62,17 +50,11 @@ def CodeRefsTo(ea, flow):
for ref in CodeRefsTo(get_screen_ea(), 1):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
# we can use the new generators
# xref = ida_xref.xrefblk_t()
# if flow == 1:
# yield from xref.crefs_to(ea)
# else:
# yield from xref.fcrefs_to(ea)
xref = ida_xref.xrefblk_t()
if flow == 1:
return refs(ea, ida_xref.get_first_cref_to, ida_xref.get_next_cref_to)
yield from xref.crefs_to(ea)
else:
return refs(ea, ida_xref.get_first_fcref_to, ida_xref.get_next_fcref_to)
yield from xref.fcrefs_to(ea)
def CodeRefsFrom(ea, flow):
@@ -90,12 +72,11 @@ def CodeRefsFrom(ea, flow):
for ref in CodeRefsFrom(get_screen_ea(), 1):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
xref = ida_xref.xrefblk_t()
if flow == 1:
return refs(ea, ida_xref.get_first_cref_from, ida_xref.get_next_cref_from)
yield from xref.crefs_from(ea)
else:
return refs(ea, ida_xref.get_first_fcref_from, ida_xref.get_next_fcref_from)
yield from xref.fcrefs_from(ea)
def DataRefsTo(ea):
"""
@@ -110,8 +91,8 @@ def DataRefsTo(ea):
for ref in DataRefsTo(get_screen_ea()):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
return refs(ea, ida_xref.get_first_dref_to, ida_xref.get_next_dref_to)
xref = ida_xref.xrefblk_t()
yield from xref.drefs_to(ea)
def DataRefsFrom(ea):
@@ -127,8 +108,8 @@ def DataRefsFrom(ea):
for ref in DataRefsFrom(get_screen_ea()):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
return refs(ea, ida_xref.get_first_dref_from, ida_xref.get_next_dref_from)
xref = ida_xref.xrefblk_t()
yield from xref.drefs_from(ea)
# Xref type names table
+9 -7
View File
@@ -363,6 +363,7 @@ def rotate_left(value, count, nbits, offset):
"""
assert offset >= 0, "offset must be >= 0"
assert nbits > 0, "nbits must be > 0"
count %= nbits # no need to spin the wheel more than 1 rotation
mask = 2**(offset+nbits) - 2**offset
tmp = value & mask
@@ -554,11 +555,11 @@ def set_name(ea, name, flags=ida_name.SN_CHECK):
"""
return ida_name.set_name(ea, name, flags)
SN_CHECK = ida_name.SN_CHECK
SN_CHECK = ida_name.SN_CHECK # Fail if the name contains invalid characters.
SN_NOCHECK = ida_name.SN_NOCHECK # Don't fail if the name contains invalid characters.
# If this bit is clear, all invalid chars
# (those !is_ident_cp()) will be replaced
# by SUBSTCHAR (usually '_').
# If this bit is set, all invalid chars
# (not in NameChars or MangleChars) will be replaced
# by '_'.
# List of valid characters is defined in ida.cfg
SN_PUBLIC = ida_name.SN_PUBLIC # if set, make name public
SN_NON_PUBLIC = ida_name.SN_NON_PUBLIC # if set, make name non-public
@@ -2970,6 +2971,8 @@ FUNC_PURGED_OK = _scope.FUNC_PURGED_OK # 'argsize' field has been valida
FUNC_TAIL = _scope.FUNC_TAIL # This is a function tail.
# Other bits must be clear
# (except FUNC_HIDDEN)
FUNC_LUMINA = _scope.FUNC_LUMINA # Function info is provided by Lumina.
FUNC_OUTLINE = _scope.FUNC_OUTLINE # Outlined code, not a real function.
def set_func_flags(ea, flags):
@@ -5351,9 +5354,8 @@ get_process_state = ida_dbg.get_process_state
DSTATE_SUSP = -1 # process is suspended
DSTATE_NOTASK = 0 # no process is currently debugged
DSTATE_RUN = 1 # process is running
DSTATE_RUN_WAIT_ATTACH = 2 # process is running, waiting for process properly attached
DSTATE_RUN_WAIT_END = 3 # process is running, but the user asked to kill/detach the process
# remark: in this case, most events are ignored
DSTATE_RUN_WAIT_ATTACH = 2 # deprecated
DSTATE_RUN_WAIT_END = 3 # deprecated
"""
Get various information about the current debug event
+97 -130
View File
@@ -85,13 +85,7 @@ ref_t ida_export PyW_SizeVecToPyList(const sizevec_t &vec)
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_list(PyList_New(n));
for ( size_t i = 0; i < n; ++i )
{
#ifdef PY3
PyList_SetItem(py_list.o, i, PyLong_FromSize_t(vec[i]));
#else
PyList_SetItem(py_list.o, i, PyInt_FromSize_t(vec[i]));
#endif
}
return ref_t(py_list);
}
@@ -194,7 +188,6 @@ Py_ssize_t ida_export PyW_PyListToEaVec(eavec_t *out, PyObject *py_list)
eavec_t &eavec = *(eavec_t *) ud;
ea_t ea = BADADDR;
{
#ifdef PY3
if ( PyLong_Check(py_item.o) )
{
unsigned long long ull = PyLong_AsUnsignedLongLong(py_item.o);
@@ -206,16 +199,6 @@ Py_ssize_t ida_export PyW_PyListToEaVec(eavec_t *out, PyObject *py_list)
{
return CIP_FAILED;
}
#else
if ( PyInt_Check(py_item.o) )
ea = PyInt_AsUnsignedLongMask(py_item.o);
else if ( PyLong_Check(py_item.o) )
ea = ea_t(PyLong_AsUnsignedLongLong(py_item.o));
else
return CIP_FAILED;
if ( PyErr_Occurred() != nullptr )
return CIP_FAILED;
#endif
}
eavec.push_back(ea);
return CIP_OK;
@@ -235,7 +218,6 @@ Py_ssize_t ida_export PyW_PyListToEa64Vec(ea64vec_t *out, PyObject *py_list)
ea64vec_t &ea64vec = *(ea64vec_t *) ud;
ea64_t v = 0;
{
#ifdef PY3
if ( PyLong_Check(py_item.o) )
{
unsigned long long ull = PyLong_AsUnsignedLongLong(py_item.o);
@@ -247,16 +229,6 @@ Py_ssize_t ida_export PyW_PyListToEa64Vec(ea64vec_t *out, PyObject *py_list)
{
return CIP_FAILED;
}
#else
if ( PyInt_Check(py_item.o) )
v = PyInt_AsUnsignedLongMask(py_item.o);
else if ( PyLong_Check(py_item.o) )
v = uint64(PyLong_AsUnsignedLongLong(py_item.o));
else
return CIP_FAILED;
if ( PyErr_Occurred() != nullptr )
return CIP_FAILED;
#endif
}
ea64vec.push_back(v);
return CIP_OK;
@@ -274,9 +246,9 @@ Py_ssize_t ida_export PyW_PyListToStrVec(qstrvec_t *out, PyObject *py_list)
static int idaapi cvt(const ref_t &py_item, Py_ssize_t /*i*/, void *ud)
{
qstrvec_t &strvec = *(qstrvec_t *)ud;
if ( !IDAPyStr_Check(py_item.o) )
if ( !PyUnicode_Check(py_item.o) )
return CIP_FAILED;
IDAPyStr_AsUTF8(&strvec.push_back(), py_item.o);
PyUnicode_as_qstring(&strvec.push_back(), py_item.o);
return CIP_OK;
}
};
@@ -330,15 +302,31 @@ void ida_export PyW_unregister_compiled_form(PyObject *py_form)
//-------------------------------------------------------------------------
static void free_compiled_form_instances(void)
{
int max_nloop = py_compiled_form_vec.size();
max_nloop *= 10; // i'm feeling generous today
int cnt = 0;
while ( !py_compiled_form_vec.empty() )
{
const ref_t &ref = py_compiled_form_vec[0];
const ref_t &ref = py_compiled_form_vec.back();
qstring title;
if ( !PyW_GetStringAttr(ref.o, "title", &title) )
title = "<unknown title>";
msg("WARNING: Form \"%s\" was not Free()d. Force-freeing.\n", title.c_str());
// Will call 'py_unregister_compiled_form()', and thus trim the vector down.
newref_t unused(PyObject_CallMethod(ref.o, (char *)"Free", "()"));
newref_t result(PyObject_CallMethod(ref.o, (char *)"Free", "()"));
if ( result == nullptr && PyErr_Occurred() != nullptr )
{
msg("WARNING: Couldn't free form object at %p:\n", ref.o);
PyErr_Print();
py_compiled_form_vec.del(ref);
}
if ( ++cnt >= max_nloop )
{
#ifdef TESTABLE_BUILD
INTERR(30640); // too many iterations, probably we are looping endlessly
#endif
break;
}
}
}
@@ -353,9 +341,9 @@ static int get_pyidc_cvt_type(PyObject *py_var)
// Check if this our special by reference object
ref_t attr(PyW_TryGetAttrString(py_var, S_PY_IDCCVT_ID_ATTR));
if ( attr == nullptr || !IDAPyIntOrLong_Check(attr.o) )
if ( attr == nullptr || !PyLong_Check(attr.o) )
return -1;
return int(IDAPyIntOrLong_AsLong(attr.o));
return int(PyLong_AsLong(attr.o));
}
//-------------------------------------------------------------------------
@@ -477,28 +465,16 @@ static int pyvar_to_idcvar2(
return CIP_OK;
}
// String
#ifdef PY3
else if ( PyBytes_Check(py_var.o) )
{
idc_var->_set_string(PyBytes_AsString(py_var.o), PyBytes_Size(py_var.o));
}
#else
else if ( PyString_Check(py_var.o) )
{
idc_var->_set_string(PyString_AsString(py_var.o), PyString_Size(py_var.o));
}
#endif
// Unicode
else if ( PyUnicode_Check(py_var.o) )
{
#ifdef PY3
qstring utf8;
IDAPyStr_AsUTF8(&utf8, py_var.o);
PyUnicode_as_qstring(&utf8, py_var.o);
idc_var->_set_string(utf8.c_str(), utf8.length());
#else
newref_t utf8(PyUnicode_AsEncodedString(py_var.o, ENC_UTF8, "strict"));
return pyvar_to_idcvar1(utf8, idc_var, gvar_sn, visited);
#endif
}
// Boolean
else if ( PyBool_Check(py_var.o) )
@@ -545,11 +521,7 @@ static int pyvar_to_idcvar2(
if ( ok )
{
// Form the attribute name
#ifdef PY3
newref_t py_int(PyLong_FromSsize_t(i));
#else
newref_t py_int(PyInt_FromSsize_t(i));
#endif
ok = PyW_ObjectToString(py_int.o, &attr_name);
if ( !ok )
break;
@@ -678,13 +650,9 @@ static int pyvar_to_idcvar2(
for ( Py_ssize_t i=0; i < size; i++ )
{
borref_t item(PyList_GetItem(py_dir.o, i));
#ifdef PY3
qstring field_name_buf;
IDAPyStr_AsUTF8(&field_name_buf, item.o);
PyUnicode_as_qstring(&field_name_buf, item.o);
const char *field_name = field_name_buf.begin();
#else
const char *field_name = PyString_AsString(item.o);
#endif
if ( field_name == nullptr )
continue;
@@ -807,9 +775,9 @@ int ida_export idcvar_to_pyvar(
{
const qstring &s = idc_var.qstr();
if ( (flags & PYWCVTF_STR_AS_BYTES) != 0 )
*py_var = newref_t(IDAPyBytes_FromMemAndSize(s.begin(), s.length()));
*py_var = newref_t(PyBytes_FromStringAndSize(s.begin(), s.length()));
else
*py_var = newref_t(IDAPyStr_FromUTF8AndSize(s.begin(), s.length()));
*py_var = newref_t(PyUnicode_FromStringAndSize(s.begin(), s.length()));
break;
}
else
@@ -1019,6 +987,7 @@ static ref_t compat_idaapi_module;
static bool pywraps_initialized = false;
#define SWIG_RUNTIME_VERSION "4"
#define SWIG_RUNTIME_DATA "swig_runtime_data" SWIG_RUNTIME_VERSION
//------------------------------------------------------------------------
// check if we have a file which is known to be executed automatically
@@ -1036,7 +1005,7 @@ static bool pywraps_check_autoscripts(char *buf, size_t bufsize)
static const char *const fns[] =
{
"swig_runtime_data" SWIG_RUNTIME_VERSION,
SWIG_RUNTIME_DATA,
"sitecustomize",
"usercustomize"
};
@@ -1222,7 +1191,7 @@ bool ida_export PyW_GetStringAttr(
ref_t py_attr(PyW_TryGetAttrString(py_obj, attr_name));
if ( py_attr == nullptr )
return false;
return IDAPyStr_Check(py_attr.o) != 0 && IDAPyStr_AsUTF8(str, py_attr.o);
return PyUnicode_Check(py_attr.o) && PyUnicode_as_qstring(str, py_attr.o);
}
//------------------------------------------------------------------------
@@ -1243,7 +1212,7 @@ ref_t ida_export PyW_TryImportModule(const char *name)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t result(PyImport_ImportModule(name));
if ( result == nullptr && PyErr_Occurred() )
if ( result == nullptr && PyErr_Occurred() != nullptr )
PyErr_Clear();
return result;
}
@@ -1274,19 +1243,15 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
#define SETNUM(numexpr, is64_expr) \
do \
{ \
if ( num != nullptr ) \
if ( num != nullptr ) \
*num = numexpr; \
if ( is_64 != nullptr ) \
if ( is_64 != nullptr ) \
*is_64 = is64_expr; \
} while ( false )
do
{
#ifdef PY3
if ( !PyLong_CheckExact(py_var) )
#else
if ( !(PyInt_CheckExact(py_var) || PyLong_CheckExact(py_var)) )
#endif
{
rc = false;
break;
@@ -1295,12 +1260,8 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
constexpr bool is_long_64 = sizeof(long) > 4;
// Can we convert to C long?
#ifdef PY3
long l = PyLong_AsLong(py_var);
#else
long l = PyInt_AsLong(py_var);
#endif
if ( !PyErr_Occurred() )
if ( PyErr_Occurred() == nullptr )
{
SETNUM(uint64(l), is_long_64);
break;
@@ -1311,7 +1272,7 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
// Can be fit into a C unsigned long?
unsigned long ul = PyLong_AsUnsignedLong(py_var);
if ( !PyErr_Occurred() ) //-V547 '!PyErr_Occurred()' is always false
if ( PyErr_Occurred() == nullptr ) //-V547 'PyErr_Occurred() == nullptr' is always false
{
SETNUM(uint64(ul), is_long_64);
break;
@@ -1320,7 +1281,7 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
// Try to parse as int64
PY_LONG_LONG ll = PyLong_AsLongLong(py_var);
if ( !PyErr_Occurred() ) //-V547 '!PyErr_Occurred()' is always false
if ( PyErr_Occurred() == nullptr ) //-V547 'PyErr_Occurred() == nullptr' is always false
{
SETNUM(uint64(ll), true);
break;
@@ -1345,7 +1306,7 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
{
PyErr_Clear();
ull = PyLong_AsUnsignedLongLong(py_num.o);
if ( !PyErr_Occurred() ) //-V547 '!PyErr_Occurred()' is always false
if ( PyErr_Occurred() == nullptr ) //-V547 'PyErr_Occurred() == nullptr' is always false
{
SETNUM(uint64(ull), true);
rc = true;
@@ -1390,13 +1351,8 @@ bool ida_export PyW_ObjectToString(PyObject *obj, qstring *out)
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_str(PyObject_Str(obj));
bool ok = py_str != nullptr;
#ifdef PY3
if ( ok )
IDAPyStr_AsUTF8(out, py_str.o);
#else
if ( ok )
*out = PyString_AsString(py_str.o);
#endif
PyUnicode_as_qstring(out, py_str.o);
else
out->qclear();
return ok;
@@ -1436,7 +1392,7 @@ bool ida_export PyW_GetError(qstring *out, bool clear_err)
py_ret = newref_t(PyObject_Str(err_value));
if ( py_ret != nullptr )
IDAPyStr_AsUTF8(out, py_ret.o);
PyUnicode_as_qstring(out, py_ret.o);
else
*out = "IDAPython: unknown error";
@@ -1510,13 +1466,15 @@ void ida_export lookup_info_t_commit(lookup_info_t *_this, lookup_entry_t &e, TW
}
//-------------------------------------------------------------------------
#define FIND_BY__BODY(self, crit, res) \
for ( lookup_entries_t::const_iterator it = self->entries.begin(); it != self->entries.end(); ++it ) \
#define FIND_BY__BODY(self, crit, res) \
for ( lookup_entries_t::const_iterator it = self->entries.begin(); \
it != self->entries.end(); \
++it ) \
{ \
const lookup_entry_t &e = *it; \
if ( e.crit == crit ) \
{ \
if ( out_##res != nullptr ) \
if ( out_##res != nullptr ) \
*out_##res = e.res; \
return true; \
} \
@@ -1577,19 +1535,19 @@ PyObject *ida_export py_customidamemo_t_create_groups(
if ( nodes.o == nullptr || !PySequence_Check(nodes.o) )
continue;
borref_t text(PyDict_GetItemString(item.o, "text"));
if ( text.o == nullptr || !IDAPyStr_Check(text.o) )
if ( text.o == nullptr || !PyUnicode_Check(text.o) )
continue;
group_crinfo_t gi;
Py_ssize_t nodes_cnt = PySequence_Size(nodes.o);
for ( Py_ssize_t k = 0; k < nodes_cnt; ++k )
{
newref_t node(PySequence_GetItem(nodes.o, k));
if ( IDAPyInt_Check(node.o) )
gi.nodes.add_unique(IDAPyInt_AsLong(node.o));
if ( PyLong_Check(node.o) )
gi.nodes.add_unique(PyLong_AsLong(node.o));
}
if ( !gi.nodes.empty() )
{
IDAPyStr_AsUTF8(&gi.text, text.o);
PyUnicode_as_qstring(&gi.text, text.o);
gis.push_back(gi);
}
}
@@ -1599,7 +1557,7 @@ PyObject *ida_export py_customidamemo_t_create_groups(
PyObject *py_groups = PyList_New(0);
for ( intvec_t::const_iterator it = groups.begin(); it != groups.end(); ++it )
PyList_Append(py_groups, IDAPyInt_FromLong(long(*it)));
PyList_Append(py_groups, PyLong_FromLong(long(*it)));
return py_groups;
}
@@ -1610,9 +1568,9 @@ static void pynodes_to_idanodes(intvec_t *idanodes, ref_t pynodes)
for ( Py_ssize_t i = 0; i < sz; ++i )
{
newref_t item(PySequence_GetItem(pynodes.o, i));
if ( !IDAPyInt_Check(item.o) )
if ( !PyLong_Check(item.o) )
continue;
idanodes->add_unique(IDAPyInt_AsLong(item.o));
idanodes->add_unique(PyLong_AsLong(item.o));
}
}
@@ -1630,7 +1588,7 @@ PyObject *ida_export py_customidamemo_t_delete_groups(
pynodes_to_idanodes(&ida_groups, groups);
if ( ida_groups.empty() )
Py_RETURN_NONE;
if ( viewer_delete_groups(_this->view, ida_groups, int(IDAPyInt_AsLong(new_current.o))) )
if ( viewer_delete_groups(_this->view, ida_groups, int(PyLong_AsLong(new_current.o))) )
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -1646,7 +1604,9 @@ PyObject *ida_export py_customidamemo_t_set_groups_visibility(
if ( !PySequence_Check(_groups)
|| !PyBool_Check(_expand)
|| !PyNumber_Check(_new_current) )
{
Py_RETURN_NONE;
}
borref_t groups(_groups);
borref_t expand(_expand);
borref_t new_current(_new_current);
@@ -1654,11 +1614,7 @@ PyObject *ida_export py_customidamemo_t_set_groups_visibility(
pynodes_to_idanodes(&ida_groups, groups);
if ( ida_groups.empty() )
Py_RETURN_NONE;
#ifdef PY3
if ( viewer_set_groups_visibility(_this->view, ida_groups, expand.o == Py_True, int(PyLong_AsLong(new_current.o))) )
#else
if ( viewer_set_groups_visibility(_this->view, ida_groups, expand.o == Py_True, int(PyInt_AsLong(new_current.o))) )
#endif
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
@@ -1780,14 +1736,14 @@ static void til_clear_python_tinfo_t_instances(void)
}
#define DEF_REG_UNREG_REFCOUNTED(Type) \
void ida_export til_register_python_##Type##_instance(Type *inst) \
void ida_export til_register_python_##Type##_instance(Type *inst) \
{ \
/* Let's add_unique() it, because in the case of tinfo_t, every reference*/ \
/* to an object's tinfo_t property will end up trying to register it. */ \
py_##Type##_vec.add_unique(inst); \
} \
\
void ida_export til_deregister_python_##Type##_instance(Type *inst) \
void ida_export til_deregister_python_##Type##_instance(Type *inst) \
{ \
qvector<Type*>::iterator found = py_##Type##_vec.find(inst); \
if ( found != py_##Type##_vec.end() ) \
@@ -1861,11 +1817,7 @@ ssize_t ida_export get_callable_arg_count(ref_t callable)
ssize_t cnt = -1;
if ( py_module != nullptr )
{
#ifdef PY3
ref_t py_fun = PyW_TryGetAttrString(py_module.o, "getfullargspec");
#else
ref_t py_fun = PyW_TryGetAttrString(py_module.o, "getargspec");
#endif
if ( py_fun != nullptr )
{
newref_t py_tuple(PyObject_CallFunctionObjArgs(py_fun.o, callable.o, nullptr));
@@ -1897,12 +1849,48 @@ struct hook_data_t
hook_type_t type;
hook_cb_t *cb;
void *ud;
bool is_hooks_base;
bool is_hooks_base; // FIXME: what is the meaning of this field and where it is used?
};
DECLARE_TYPE_AS_MOVABLE(hook_data_t);
typedef qvector<hook_data_t> hook_data_vec_t;
static hook_data_vec_t hook_data_vec;
//-------------------------------------------------------------------------
void ida_export idapython_register_hook(
hook_type_t hook_type,
hook_cb_t *cb,
void *user_data,
bool is_hooks_base)
{
hook_data_t &hd = hook_data_vec.push_back();
hd.type = hook_type;
hd.cb = cb;
hd.ud = user_data;
hd.is_hooks_base = is_hooks_base;
}
//-------------------------------------------------------------------------
void ida_export idapython_unregister_hook(
hook_type_t hook_type,
hook_cb_t *cb,
void *user_data)
{
bool found = false;
for ( size_t i = 0, n = hook_data_vec.size(); i < n; ++i )
{
const hook_data_t &hd = hook_data_vec[i];
if ( hd.type == hook_type && hd.cb == cb && hd.ud == user_data )
{
hook_data_vec.erase(hook_data_vec.begin() + i);
found = true;
break;
}
}
#ifdef TESTABLE_BUILD
QASSERT(30510, found);
#endif // TESTABLE_BUILD
}
//-------------------------------------------------------------------------
bool ida_export idapython_hook_to_notification_point(
hook_type_t hook_type,
@@ -1912,13 +1900,7 @@ bool ida_export idapython_hook_to_notification_point(
{
bool ok = hook_to_notification_point(hook_type, cb, user_data);
if ( ok )
{
hook_data_t &hd = hook_data_vec.push_back();
hd.type = hook_type;
hd.cb = cb;
hd.ud = user_data;
hd.is_hooks_base = is_hooks_base;
}
idapython_register_hook(hook_type, cb, user_data, is_hooks_base);
return ok;
}
@@ -1930,22 +1912,7 @@ bool ida_export idapython_unhook_from_notification_point(
{
bool ok = unhook_from_notification_point(hook_type, cb, user_data) > 0;
if ( ok )
{
bool found = false;
for ( size_t i = 0, n = hook_data_vec.size(); i < n; ++i )
{
const hook_data_t &hd = hook_data_vec[i];
if ( hd.type == hook_type && hd.cb == cb && hd.ud == user_data )
{
hook_data_vec.erase(hook_data_vec.begin() + i);
found = true;
break;
}
}
#ifdef TESTABLE_BUILD
QASSERT(30510, found);
#endif // TESTABLE_BUILD
}
idapython_unregister_hook(hook_type, cb, user_data);
return ok;
}
@@ -1964,14 +1931,14 @@ bool ida_export idapython_convert_cli_completions(
borref_t i0(PyTuple_GetItem(py_res.o, 0));
borref_t i1(PyTuple_GetItem(py_res.o, 1));
borref_t i2(PyTuple_GetItem(py_res.o, 2));
ok = PyList_Check(i0.o) && IDAPyInt_Check(i1.o) && IDAPyInt_Check(i2.o);
ok = PyList_Check(i0.o) && PyLong_Check(i1.o) && PyLong_Check(i2.o);
if ( ok )
{
ok = PyW_PyListToStrVec(out_completions, i0.o) > 0;
if ( ok )
{
*out_match_start = IDAPyInt_AsLong(i1.o);
*out_match_end = IDAPyInt_AsLong(i2.o);
*out_match_start = PyLong_AsLong(i1.o);
*out_match_end = PyLong_AsLong(i2.o);
ok = PyErr_Occurred() == nullptr;
}
else
+120 -44
View File
@@ -12,16 +12,9 @@
#define PY_BV_ASIZE PY_BV_EA
#define PY_BV_SEL PY_BV_EA
#define PY_BV_SVAL "L" // Convert a C long long to a Python long integer object
#ifdef PY3
# define PY_BV_TYPE "y"
# define PY_BV_FIELDS "y"
# define PY_BV_BYTES "y"
#else
# define PY_BV_TYPE "s"
# define PY_BV_FIELDS "s"
# define PY_BV_BYTES "s"
#endif
#define PY_BV_TYPE "y"
#define PY_BV_FIELDS "y"
#define PY_BV_BYTES "y"
typedef unsigned PY_LONG_LONG bvea_t;
typedef Py_ssize_t bvsz_t;
@@ -157,6 +150,59 @@ static const char S_PY_IDA_IDAAPI_MODNAME[] = S_IDA_IDAAPI_MODNAME;
#define CIP_OK 1 // Success
#define CIP_OK_OPAQUE 2 // Success, but the data pointed to by the PyObject* is an opaque object.
//-------------------------------------------------------------------------
inline bool PyUnicode_as_qstring(qstring *out, PyObject *obj)
{
PyObject *utf8 = PyUnicode_AsUTF8String(obj);
bool ok = utf8 != nullptr;
if ( ok )
{
char *buffer = nullptr;
Py_ssize_t length = 0;
ok = PyBytes_AsStringAndSize(utf8, &buffer, &length) >= 0;
if ( ok )
{
out->qclear();
out->append(buffer, length);
}
}
Py_XDECREF(utf8);
return ok;
}
//-------------------------------------------------------------------------
inline PyObject *PyUnicode_from_qstring(const qstring &s)
{
return PyUnicode_FromStringAndSize(s.c_str(), s.length());
}
//-------------------------------------------------------------------------
inline bool PyBytes_as_bytevec_t(bytevec_t *out, PyObject *obj)
{
char *buffer = nullptr;
Py_ssize_t length = 0;
bool ok = PyBytes_AsStringAndSize(obj, &buffer, &length) >= 0;
if ( ok )
{
out->qclear();
out->append((const uchar *) buffer, length);
}
return ok;
}
//-------------------------------------------------------------------------
inline bool PyBytes_as_qtype(qtype *out, PyObject *obj)
{
bytevec_t bytes;
bool ok = PyBytes_as_bytevec_t(&bytes, obj);
if ( ok )
{
out->qclear();
out->append(bytes.begin(), bytes.size());
}
return ok;
}
//---------------------------------------------------------------------------
class gil_lock_t
{
@@ -184,19 +230,12 @@ idaman uint32 ida_export_data debug;
THREAD_SAFE AS_PRINTF(1, 2) inline int msg(const char *format, ...);
#endif // __KERNWIN_HPP
#ifdef PY3
# ifdef Py_LIMITED_API
# define GIL_CHKCONDFAIL (false)
# else
# define GIL_CHKCONDFAIL (((debug & IDA_DEBUG_PLUGIN) != 0) && !PyGILState_Check())
# endif
#ifdef Py_LIMITED_API
# define GIL_CHKCONDFAIL (false)
#else
# define GIL_CHKCONDFAIL (((debug & IDA_DEBUG_PLUGIN) != 0) \
&& PyGILState_GetThisThreadState() != _PyThreadState_Current)
# define GIL_CHKCONDFAIL (((debug & IDA_DEBUG_PLUGIN) != 0) && !PyGILState_Check())
#endif
#include "idapy.hpp"
#define PYW_GIL_CHECK_LOCKED_SCOPE() \
do \
{ \
@@ -808,11 +847,7 @@ struct idapython_plugin_t : public plugmod_t, public event_listener_t
qstring idapython_dir;
qstring requested_plugin_path;
#ifdef __MAC__
# ifdef PY3
qvector<wchar_t> pyhomepath;
# else
qstring pyhomepath;
# endif
#endif
bool initialized;
bool ui_ready;
@@ -1051,6 +1086,17 @@ py_customidamemo_t::~py_customidamemo_t()
get_plugin_instance()->pycim_lookup_info.del_by_py_view(this);
}
//-------------------------------------------------------------------------
idaman void ida_export idapython_register_hook(
hook_type_t hook_type,
hook_cb_t *cb,
void *user_data,
bool is_hooks_base);
idaman void ida_export idapython_unregister_hook(
hook_type_t hook_type,
hook_cb_t *cb,
void *user_data);
//-------------------------------------------------------------------------
idaman bool ida_export idapython_hook_to_notification_point(
hook_type_t hook_type,
@@ -1069,16 +1115,52 @@ idaman bool ida_export idapython_unhook_from_notification_point(
#define HBF_VOLATILE_METHOD_SET 0x00000002
struct hooks_base_t
{
struct idapython_listener_t : public event_listener_t
{
hook_cb_t *cb;
void *ud;
idapython_listener_t(hook_cb_t *_cb, void *_ud) : cb(_cb), ud(_ud) {}
virtual ssize_t idaapi on_event(ssize_t code, va_list va) override
{
return cb(ud, code, va);
}
};
const char *class_name;
qstring identifier;
hook_cb_t *cb;
idapython_listener_t listener;
hook_type_t type;
uint32 flags;
uint32 hkcb_flags;
typedef std::map<int,uchar> has_nondef_map_t;
has_nondef_map_t has_nondef;
bool hook_added = false;
bool hook() { return cb != nullptr && idapython_hook_to_notification_point(type, cb, this, true); }
bool unhook() { return cb != nullptr && idapython_unhook_from_notification_point(type, cb, this); }
bool hook()
{
if ( !hook_added
&& listener.cb != nullptr
&& hook_event_listener(type, &listener, nullptr /*owner*/, hkcb_flags) )
{
idapython_register_hook(type, listener.cb, this, true);
hook_added = true;
}
return hook_added;
}
bool unhook()
{
if ( hook_added && listener.cb != nullptr )
{
// there is no need to check the return result of unhook_event_listener,
// if HKCB_GLOBAL flag is not used
// the LISTENER will be freed earlier
// than this method will be called.
unhook_event_listener(type, &listener);
idapython_unregister_hook(type, listener.cb, this);
hook_added = false;
}
return !hook_added;
}
bool call_requires_new_execution() const { return (flags & HBF_CALL_WITH_NEW_EXEC) != 0; }
bool has_fixed_method_set() const { return (flags & HBF_VOLATILE_METHOD_SET) == 0; }
@@ -1087,11 +1169,13 @@ struct hooks_base_t
const char *_class_name,
hook_cb_t *_cb,
hook_type_t _type,
uint32 _flags=0)
uint32 _flags,
uint32 _hkcb_flags)
: class_name(_class_name),
cb(_cb),
listener(_cb, this),
type(_type),
flags(_flags) {}
flags(_flags),
hkcb_flags(_hkcb_flags) {}
virtual ~hooks_base_t() { unhook(); }
@@ -1112,10 +1196,10 @@ protected:
ref_t py_id;
if ( PyObject_HasAttrString(self, "id") )
py_id = newref_t(PyObject_GetAttrString(self, "id"));
if ( py_id == nullptr || !IDAPyStr_Check(py_id.o) )
if ( py_id == nullptr || !PyUnicode_Check(py_id.o) )
py_id = newref_t(PyObject_Repr(self));
if ( py_id != nullptr && IDAPyStr_Check(py_id.o) )
IDAPyStr_AsUTF8(&identifier, py_id.o);
if ( py_id != nullptr && PyUnicode_Check(py_id.o) )
PyUnicode_as_qstring(&identifier, py_id.o);
}
// method set
@@ -1150,17 +1234,9 @@ protected:
if ( py_def_meth != nullptr && py_this_meth != nullptr )
{
if ( PyObject_HasAttrString(py_def_meth.o, "__trampoline") > 0 )
{
_has_nondef = 2;
}
else
{
#ifdef PY3
_has_nondef = PyObject_RichCompareBool(py_this_meth.o, py_def_meth.o, Py_EQ) == 0 ? 1 : 0;
#else
_has_nondef = PyObject_Compare(py_this_meth.o, py_def_meth.o) != 0 ? 1 : 0;
#endif
}
}
has_nondef[cur.code] = _has_nondef;
}
@@ -1194,7 +1270,7 @@ protected:
qstring buf;
#ifdef TESTABLE_BUILD
buf.sprnt("%s(this=%p) \"%s\" {type=%d, cb=%p, flags=%x}",
class_name, this, identifier.c_str(), int(type), cb, flags);
class_name, this, identifier.c_str(), int(type), listener.cb, flags);
if ( has_fixed_method_set() )
{
for ( size_t i = 0; i < mappings_size; ++i )
@@ -1228,7 +1304,7 @@ protected:
PyErr_Format(PyExc_NotImplementedError,
"%s(this=%p) \"%s\" {type=%d, cb=%p, flags=%x} is "
"missing reimplementations for: \"%s\"",
class_name, this, identifier.c_str(), int(type), cb,
class_name, this, identifier.c_str(), int(type), listener.cb,
flags, ebuf.c_str());
return nullptr;
}
@@ -1244,7 +1320,7 @@ protected:
qnotused(mappings);
qnotused(mappings_size);
#endif
return IDAPyStr_FromUTF8(buf);
return PyUnicode_from_qstring(buf);
}
};
+5 -5
View File
@@ -21,7 +21,7 @@ static int idaapi py_visit_patched_bytes_cb(
o,
v));
PyW_ShowCbErr("visit_patched_bytes");
return (py_result != nullptr && IDAPyInt_Check(py_result.o)) ? IDAPyInt_AsLong(py_result.o) : 0;
return (py_result != nullptr && PyLong_Check(py_result.o)) ? PyLong_AsLong(py_result.o) : 0;
}
//-------------------------------------------------------------------------
@@ -52,7 +52,7 @@ static bool py_do_get_bytes(
// Allocate memory via Python
newref_t py_bytes(IDAPyBytes_FromMemAndSize(nullptr, Py_ssize_t(size)));
newref_t py_bytes(PyBytes_FromStringAndSize(nullptr, Py_ssize_t(size)));
if ( py_bytes == nullptr )
break;
@@ -61,7 +61,7 @@ static bool py_do_get_bytes(
mask.resize((size + 7) / 8, 0);
// Read bytes
int code = get_bytes(IDAPyBytes_AsString(py_bytes.o),
int code = get_bytes(PyBytes_AsString(py_bytes.o),
size,
ea,
gmb_flags,
@@ -72,7 +72,7 @@ static bool py_do_get_bytes(
// note: specify size, as '0' bytes would otherwise cut the mask short
if ( has_mask )
{
newref_t py_mask(IDAPyBytes_FromMemAndSize(
newref_t py_mask(PyBytes_FromStringAndSize(
(const char *) mask.begin(),
mask.size()));
if ( py_mask == nullptr )
@@ -213,7 +213,7 @@ static PyObject *py_get_strlit_contents(
if ( type == STRTYPE_C && buf.length() > 0 && buf.last() == '\0' )
buf.remove_last();
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_buf(IDAPyBytes_FromMemAndSize(buf.begin(), buf.length()));
newref_t py_buf(PyBytes_FromStringAndSize(buf.begin(), buf.length()));
py_buf.incref();
return py_buf.o;
}
+6 -6
View File
@@ -188,7 +188,7 @@ private:
PYW_GIL_GET;
// Build a string from the buffer
newref_t py_value(IDAPyBytes_FromMemAndSize(
newref_t py_value(PyBytes_FromStringAndSize(
(const char *)value,
Py_ssize_t(size)));
if ( py_value == nullptr )
@@ -209,10 +209,10 @@ private:
return false;
bool ok = false;
if ( IDAPyStr_Check(py_result.o) )
if ( PyUnicode_Check(py_result.o) )
{
if ( out != nullptr )
IDAPyStr_AsUTF8(out, py_result.o);
PyUnicode_as_qstring(out, py_result.o);
ok = true;
}
return ok;
@@ -264,7 +264,7 @@ private:
Py_ssize_t len;
char *buf;
if ( IDAPyBytes_AsMemAndSize(py_val.o, &buf, &len) != -1 )
if ( PyBytes_AsStringAndSize(py_val.o, &buf, &len) != -1 )
{
value->qclear();
value->append(buf, len);
@@ -274,13 +274,13 @@ private:
else
{
// Make sure the user returned (False, String)
if ( py_bool.o != Py_False || !IDAPyStr_Check(py_val.o) )
if ( py_bool.o != Py_False || !PyUnicode_Check(py_val.o) )
{
*errstr = "Invalid return value returned from the Python callback!";
break;
}
// Get the error message
IDAPyStr_AsUTF8(errstr, py_val.o);
PyUnicode_as_qstring(errstr, py_val.o);
}
} while ( false );
return ok;
+9 -9
View File
@@ -36,7 +36,7 @@ struct _cvt_status_t
qstring &failed(PyObject *_err_class)
{
QASSERT(30587, ok == false);
QASSERT(30587, !ok);
err_class = _err_class;
return err_string;
}
@@ -126,10 +126,10 @@ static bool _to_reg_val(regval_t **out, regval_t *buf, const char *name, PyObjec
if ( status.ok )
{
status.ok = false;
if ( IDAPyBytes_Check(in) )
if ( PyBytes_Check(in) )
{
char *buf;
status.ok = IDAPyBytes_AsMemAndSize(in, &buf, &got) >= 0 && got <= needed;
status.ok = PyBytes_AsStringAndSize(in, &buf, &got) >= 0 && got <= needed;
if ( status.ok )
bytes.append((const uchar *) buf, got);
else
@@ -137,7 +137,7 @@ static bool _to_reg_val(regval_t **out, regval_t *buf, const char *name, PyObjec
"List of bytes is too long; was expecting at most %d bytes",
int(needed));
}
else if ( IDAPyInt_Check(in) )
else if ( PyLong_Check(in) )
{
uint64 u64 = 0;
status.ok = PyW_GetNumber(in, &u64);
@@ -266,7 +266,7 @@ static PyObject *_from_reg_val(
case dt_byte64:
{
const bytevec_t &b = rv.bytes();
res = IDAPyBytes_FromMemAndSize((const char *) b.begin(), b.size());
res = PyBytes_FromStringAndSize((const char *) b.begin(), b.size());
}
break;
}
@@ -345,8 +345,8 @@ struct DBG_Hooks : public hooks_base_t
{
// hookgenDBG:methodsinfo_decl
DBG_Hooks(uint32 _flags=0)
: hooks_base_t("ida_dbg.DBG_Hooks", DBG_Callback, HT_DBG, _flags) {}
DBG_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL)
: hooks_base_t("ida_dbg.DBG_Hooks", DBG_Callback, HT_DBG, _flags, _hkcb_flags) {}
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
@@ -433,11 +433,11 @@ static ea_t py_internal_get_sreg_base(thid_t tid, int sreg_value)
static ssize_t py_write_dbg_memory(ea_t ea, PyObject *py_buf, size_t size=size_t(-1))
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !dbg_can_query(dbg) || !IDAPyBytes_Check(py_buf) )
if ( !dbg_can_query(dbg) || !PyBytes_Check(py_buf) )
return -1;
char *buf = nullptr;
Py_ssize_t sz;
if ( IDAPyBytes_AsMemAndSize(py_buf, &buf, &sz) < 0 )
if ( PyBytes_AsStringAndSize(py_buf, &buf, &sz) < 0 )
return -1;
if ( size == size_t(-1) )
size = size_t(sz);
+3 -3
View File
@@ -9,7 +9,7 @@ int idaapi py_enumerate_files_cb(const char *file, void *ud)
// and from the same thread as the one that executes
// 'py_enumerate_files'.
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_file(IDAPyStr_FromUTF8(file));
newref_t py_file(PyUnicode_FromString(file));
newref_t py_ret(
PyObject_CallFunctionObjArgs(
(PyObject *)ud,
@@ -54,12 +54,12 @@ PyObject *py_enumerate_files(PyObject *path, PyObject *fname, PyObject *callback
do
{
if ( !IDAPyStr_Check(path) || !IDAPyStr_Check(fname) || !PyCallable_Check(callback) )
if ( !PyUnicode_Check(path) || !PyUnicode_Check(fname) || !PyCallable_Check(callback) )
break;
qstring _path;
qstring _fname;
if ( !IDAPyStr_AsUTF8(&_path, path) || !IDAPyStr_AsUTF8(&_fname, fname) )
if ( !PyUnicode_as_qstring(&_path, path) || !PyUnicode_as_qstring(&_fname, fname) )
break;
char answer[MAXSTR];
+37 -49
View File
@@ -145,9 +145,9 @@ public:
return;
if ( own )
{
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
qfclose(fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
}
fp = nullptr;
own = true;
@@ -163,9 +163,9 @@ public:
bool open(const char *filename, const char *mode)
{
close();
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
fp = qfopen(filename, mode);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( fp == nullptr )
return false;
// Save file name
@@ -199,9 +199,9 @@ public:
static qfile_t *tmpfile()
{
FILE *fp;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
fp = qtmpfile();
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return from_fp(fp);
}
@@ -215,9 +215,9 @@ public:
int seek(int64 offset, int whence = SEEK_SET)
{
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qfseek(fp, offset, whence);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -225,9 +225,9 @@ public:
int64 tell()
{
int64 rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qftell(fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -241,16 +241,16 @@ public:
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
int r;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
r = freadbytes(fp, buf, size, big_endian);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( r != 0 )
{
free(buf);
break;
}
PyObject *ret = IDAPyStr_FromUTF8AndSize(buf, r);
PyObject *ret = PyUnicode_FromStringAndSize(buf, r);
free(buf);
return ret;
} while ( false );
@@ -267,15 +267,15 @@ public:
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
int r;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
r = qfread(fp, buf, size);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( r <= 0 )
{
free(buf);
break;
}
PyObject *ret = IDAPyStr_FromUTF8AndSize(buf, r);
PyObject *ret = PyUnicode_FromStringAndSize(buf, r);
free(buf);
return ret;
} while ( false );
@@ -292,15 +292,15 @@ public:
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
char *p;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
p = qfgets(buf, size, fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( p == nullptr )
{
free(buf);
break;
}
PyObject *ret = IDAPyStr_FromUTF8(buf);
PyObject *ret = PyUnicode_FromString(buf);
free(buf);
return ret;
} while ( false );
@@ -313,11 +313,11 @@ public:
PYW_GIL_CHECK_LOCKED_SCOPE();
char *buf;
Py_ssize_t sz;
IDAPyBytes_AsMemAndSize(py_buf, &buf, &sz);
PyBytes_AsStringAndSize(py_buf, &buf, &sz);
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = fwritebytes(fp, buf, int(sz), big_endian);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -325,16 +325,16 @@ public:
int write(PyObject *py_buf)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !IDAPyStr_Check(py_buf) )
if ( !PyUnicode_Check(py_buf) )
return 0;
// Just so that there is no risk that the buffer returned by
borref_t py_buf_ref(py_buf);
qstring buf;
IDAPyStr_AsUTF8(&buf, py_buf);
PyUnicode_as_qstring(&buf, py_buf);
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qfwrite(fp, buf.c_str(), buf.length());
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -343,9 +343,9 @@ public:
{
PYW_GIL_CHECK_LOCKED_SCOPE();
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qfputs(str, fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -354,11 +354,11 @@ public:
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qoff64_t r;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
int pos = qfseek(fp, 0, SEEK_END);
r = qftell(fp);
qfseek(fp, pos, SEEK_SET);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return r;
}
@@ -367,9 +367,9 @@ public:
{
PYW_GIL_CHECK_LOCKED_SCOPE();
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qflush(fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -377,42 +377,30 @@ public:
PyObject *filename()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
return IDAPyStr_FromUTF8(fn.c_str());
return PyUnicode_FromString(fn.c_str());
}
//--------------------------------------------------------------------------
#ifdef PY3
PyObject *get_byte()
#else
PyObject *get_char()
#endif
{
PYW_GIL_CHECK_LOCKED_SCOPE();
int ch;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
ch = qfgetc(fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ch == EOF )
Py_RETURN_NONE;
#ifdef PY3
return Py_BuildValue("i", ch);
#else
return Py_BuildValue("c", ch);
#endif
}
//--------------------------------------------------------------------------
#ifdef PY3
int put_byte(int chr)
#else
int put_char(char chr)
#endif
{
PYW_GIL_CHECK_LOCKED_SCOPE();
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qfputc(chr, fp);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
};
+10 -10
View File
@@ -188,9 +188,9 @@ private:
"O",
py_nodes.o));
PyW_ShowCbErr(S_ON_CREATING_GROUP);
return (py_result == nullptr || !IDAPyInt_Check(py_result.o))
return (py_result == nullptr || !PyLong_Check(py_result.o))
? 1
: IDAPyInt_AsLong(py_result.o);
: PyLong_AsLong(py_result.o);
}
// a group is being deleted
@@ -416,9 +416,9 @@ void py_graph_t::on_user_refresh(mutable_graph_t *g)
for ( j=0; j < qnumber(edge_ids); j++ )
{
newref_t id(PySequence_GetItem(item.o, j));
if ( id == nullptr || !IDAPyInt_Check(id.o) )
if ( id == nullptr || !PyLong_Check(id.o) )
break;
int v = int(IDAPyInt_AsLong(id.o));
int v = int(PyLong_AsLong(id.o));
if ( v > max_nodes )
break;
edge_ids[j] = v;
@@ -460,9 +460,9 @@ bool py_graph_t::on_user_text(mutable_graph_t * /*g*/, int node, const char **st
qstring buf;
// User returned a string?
if ( IDAPyStr_Check(result.o) )
if ( PyUnicode_Check(result.o) )
{
IDAPyStr_AsUTF8(&buf, result.o);
PyUnicode_as_qstring(&buf, result.o);
c = node_cache.add(node, buf.c_str(), cl);
}
// User returned a sequence of text and bgcolor
@@ -472,8 +472,8 @@ bool py_graph_t::on_user_text(mutable_graph_t * /*g*/, int node, const char **st
newref_t py_str(PySequence_GetItem(result.o, 0));
newref_t py_color(PySequence_GetItem(result.o, 1));
if ( py_str != nullptr && IDAPyStr_Check(py_str.o) )
IDAPyStr_AsUTF8(&buf, py_str.o);
if ( py_str != nullptr && PyUnicode_Check(py_str.o) )
PyUnicode_as_qstring(&buf, py_str.o);
if ( py_color != nullptr && PyNumber_Check(py_color.o) )
cl = bgcolor_t(PyLong_AsUnsignedLong(py_color.o));
@@ -510,11 +510,11 @@ int py_graph_t::_on_hint_epilog(char **hint, ref_t result)
{
// 'hint' must be allocated by qalloc() or qstrdup()
// out: 0-use default hint, 1-use proposed hint
bool ok = result != nullptr && IDAPyStr_Check(result.o);
bool ok = result != nullptr && PyUnicode_Check(result.o);
if ( ok )
{
qstring buf;
IDAPyStr_AsUTF8(&buf, result.o);
PyUnicode_as_qstring(&buf, result.o);
*hint = buf.extract();
}
return ok;
+4 -4
View File
@@ -20,7 +20,7 @@ static int is_debug_hexrays_ctree(int level)
//-------------------------------------------------------------------------
static void debug_hexrays_ctree(int level, const char *format, ...)
{
if ( is_debug_hexrays_ctree(level) )
if ( is_debug_hexrays_ctree(level) && format != nullptr )
{
va_list va;
va_start(va, format);
@@ -93,7 +93,7 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
va_list va;
va_start(va, code);
optinsn_t *oi = va_arg(va, optinsn_t *);
QASSERT(30598, remove_optinsn_handler(oi) == false); // must have been removed already
QASSERT(30598, !remove_optinsn_handler(oi)); // must have been removed already
in_removal = false;
}
#endif
@@ -109,7 +109,7 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
va_list va;
va_start(va, code);
optblock_t *ob = va_arg(va, optblock_t *);
QASSERT(30599, remove_optblock_handler(ob) == false); // must have been removed already
QASSERT(30599, !remove_optblock_handler(ob)); // must have been removed already
in_removal = false;
}
#endif
@@ -128,7 +128,7 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
if ( !in_removal )
{
in_removal = true;
QASSERT(30620, install_microcode_filter(mf, false) == false); // must have been removed already
QASSERT(30620, !install_microcode_filter(mf, false)); // must have been removed already
in_removal = false;
}
#else
+9 -9
View File
@@ -17,8 +17,8 @@ static void hexrays_unloading__unhook_hooks(void)
}
//-------------------------------------------------------------------------
Hexrays_Hooks::Hexrays_Hooks(uint32 _flags)
: hooks_base_t("ida_hexrays.Hexrays_Hooks", nullptr, hook_type_t(-1), _flags),
Hexrays_Hooks::Hexrays_Hooks(uint32 _flags, uint32 _hkcb_flags)
: hooks_base_t("ida_hexrays.Hexrays_Hooks", nullptr, hook_type_t(-1), _flags, _hkcb_flags),
hooked(false)
{
hexrays_hooks_instances.push_back(this);
@@ -50,7 +50,7 @@ struct Hexrays_Hooks : public hooks_base_t
bool hooked;
Hexrays_Hooks(uint32 _flags=0);
Hexrays_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL);
virtual ~Hexrays_Hooks();
bool hook()
@@ -95,10 +95,10 @@ private:
newref_t py_hint(PySequence_GetItem(o, 1));
newref_t py_implines(PySequence_GetItem(o, 2));
qstring plugin_hint;
if ( IDAPyInt_Check(py_rc.o)
&& IDAPyStr_Check(py_hint.o)
&& IDAPyInt_Check(py_implines.o)
&& IDAPyStr_AsUTF8(&plugin_hint, py_hint.o) )
if ( PyLong_Check(py_rc.o)
&& PyUnicode_Check(py_hint.o)
&& PyLong_Check(py_implines.o)
&& PyUnicode_as_qstring(&plugin_hint, py_hint.o) )
{
if ( !out_hint->empty()
&& out_hint->last() != '\n'
@@ -107,10 +107,10 @@ private:
out_hint->append('\n');
}
out_hint->append(plugin_hint);
rc = IDAPyInt_AsLong(py_rc.o);
rc = PyLong_AsLong(py_rc.o);
if ( rc == 2 )
rc = 0;
*out_implines += IDAPyInt_AsLong(py_implines.o);
*out_implines += PyLong_AsLong(py_implines.o);
}
}
return rc;
+14 -33
View File
@@ -6,15 +6,15 @@
#define GET_THIS() py_customidamemo_t *_this = (py_customidamemo_t *) view_extract_this(self)
#define CHK_THIS() \
GET_THIS(); \
if ( _this == NULL ) \
if ( _this == nullptr ) \
return;
#define CHK_THIS_OR_NULL() \
GET_THIS(); \
if ( _this == NULL ) \
return NULL;
if ( _this == nullptr ) \
return nullptr;
#define CHK_THIS_OR_NONE() \
GET_THIS(); \
if ( _this == NULL ) \
if ( _this == nullptr ) \
Py_RETURN_NONE
@@ -50,9 +50,9 @@ PyObject *pygc_set_groups_visibility(PyObject *self, PyObject *groups, PyObject
TWidget *pycim_get_widget(PyObject *self)
{
CHK_THIS_OR_NULL();
TWidget *widget = NULL;
TWidget *widget = nullptr;
if ( !get_plugin_instance()->pycim_lookup_info.find_by_py_view(&widget, _this) )
return NULL;
return nullptr;
return widget;
}
@@ -77,10 +77,10 @@ void pycim_view_close(PyObject *self)
static void _ida_idaapi_notify_init_term(int what)
{
newref_t py_mod(PyImport_ImportModule("ida_idaapi"));
if ( py_mod != NULL )
if ( py_mod != nullptr )
{
newref_t py_obj(PyObject_GetAttrString(py_mod.o, NOTIFY_DISPATCHER_INSTANCE));
if ( py_obj != NULL && py_obj.o != Py_None )
if ( py_obj != nullptr && py_obj.o != Py_None )
PyObject_CallMethod(py_obj.o, NOTIFY_DISPATCHER_DISPATCH_METHOD, "i", what);
}
}
@@ -124,7 +124,7 @@ static PyObject *py_parse_command_line(const char *cmdline)
PYW_GIL_CHECK_LOCKED_SCOPE();
qstrvec_t args;
if ( parse_command_line(&args, NULL, cmdline, LP_PATH_WITH_ARGS) == 0 )
if ( parse_command_line(&args, nullptr, cmdline, LP_PATH_WITH_ARGS) == 0 )
Py_RETURN_NONE;
return qstrvec2pylist(args);
}
@@ -197,33 +197,14 @@ idaman PyObject *ida_export format_basestring(PyObject *_in)
// accepts UTF-8 everywhere internally (and this will end up in a
// 'msg' call eventually.)
qstring utf8;
#ifdef PY3
if ( !IDAPyStr_AsUTF8(&utf8, _in) )
return NULL;
#else
PyObject *_pystr;
ref_t _tmp;
if ( PyUnicode_Check(_in) )
{
_tmp = newref_t(PyUnicode_AsUTF8String(_in));
if ( _tmp == NULL )
return _in;
_pystr = _tmp.o;
}
else
{
_pystr = _in;
}
if ( !IDAPyStr_AsUTF8(&utf8, _pystr) )
return NULL;
#endif
if ( !PyUnicode_as_qstring(&utf8, _in) )
return nullptr;
char *in_bytes = utf8.begin();
Py_ssize_t in_len = utf8.length();
char quote = '\'';
if ( memchr(in_bytes, '\'', in_len) != NULL
&& memchr(in_bytes, '"', in_len) == NULL )
if ( memchr(in_bytes, '\'', in_len) != nullptr
&& memchr(in_bytes, '"', in_len) == nullptr )
{
quote = '"';
}
@@ -257,7 +238,7 @@ idaman PyObject *ida_export format_basestring(PyObject *_in)
buf.append(c);
}
buf.append(quote);
return IDAPyStr_FromUTF8AndSize(buf.c_str(), buf.length());
return PyUnicode_FromStringAndSize(buf.c_str(), buf.length());
}
/*
+31 -39
View File
@@ -151,12 +151,12 @@ public:
return;
PYW_GIL_GET;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
if ( own == OWN_CREATE )
close_linput(li);
else if ( own == OWN_FROM_FP )
unmake_linput(li);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
li = nullptr;
own = OWN_NONE;
}
@@ -172,7 +172,7 @@ public:
{
close();
PYW_GIL_GET;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
li = open_linput(filename, remote);
if ( li != nullptr )
{
@@ -180,7 +180,7 @@ public:
fn = filename;
own = OWN_CREATE;
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return li != nullptr;
}
@@ -218,7 +218,7 @@ public:
{
PYW_GIL_GET;
loader_input_t *l = nullptr;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
linput_t *fp_li = make_linput(fp);
if ( fp_li != nullptr )
{
@@ -227,7 +227,7 @@ public:
l->fn.sprnt("<FILE * %p>", fp);
l->li = fp_li;
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return l;
}
@@ -242,7 +242,7 @@ public:
{
PYW_GIL_GET;
linput_t *l;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
l = create_memory_linput(start, size);
if ( l != nullptr )
{
@@ -251,7 +251,7 @@ public:
fn = "<memory>";
own = OWN_CREATE;
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return l != nullptr;
}
@@ -260,9 +260,9 @@ public:
{
int64 r;
PYW_GIL_GET;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
r = qlseek(li, pos, whence);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return r;
}
@@ -271,9 +271,9 @@ public:
{
int64 r;
PYW_GIL_GET;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
r = qltell(li);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return r;
}
@@ -286,10 +286,10 @@ public:
char *buf = (char *) malloc(sz + 5);
if ( buf == nullptr )
break;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
qlgetz(li, fpos, buf, sz);
Py_END_ALLOW_THREADS;
PyObject *ret = IDAPyStr_FromUTF8(buf);
SWIG_PYTHON_THREAD_END_ALLOW;
PyObject *ret = PyUnicode_FromString(buf);
free(buf);
return ret;
} while ( false );
@@ -303,12 +303,12 @@ public:
bytevec_t buf;
buf.resize(len);
bool ok;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
ok = qlgets((char *) buf.begin(), buf.size(), li) != nullptr;
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( !ok )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8((const char *) buf.begin());
return PyUnicode_FromString((const char *) buf.begin());
}
//--------------------------------------------------------------------------
@@ -318,12 +318,12 @@ public:
bytevec_t buf;
buf.resize(size);
ssize_t nread;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
nread = qlread(li, (char *) buf.begin(), buf.size());
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( nread <= 0 )
Py_RETURN_NONE;
return IDAPyBytes_FromMemAndSize((const char *) buf.begin(), nread);
return PyBytes_FromStringAndSize((const char *) buf.begin(), nread);
}
//--------------------------------------------------------------------------
@@ -342,12 +342,12 @@ public:
if ( buf == nullptr )
break;
int r;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
r = lreadbytes(li, buf, size, big_endian);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( r == -1 )
r = 0;
PyObject *ret = IDAPyStr_FromUTF8AndSize(buf, r);
PyObject *ret = PyUnicode_FromStringAndSize(buf, r);
free(buf);
return ret;
} while ( false );
@@ -358,9 +358,9 @@ public:
int file2base(int64 pos, ea_t ea1, ea_t ea2, int patchable)
{
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = ::file2base(li, pos, ea1, ea2, patchable);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -368,9 +368,9 @@ public:
int64 size()
{
int64 rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = qlsize(li);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -378,28 +378,20 @@ public:
PyObject *filename()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
return IDAPyStr_FromUTF8(fn.c_str());
return PyUnicode_FromString(fn.c_str());
}
//--------------------------------------------------------------------------
#ifdef PY3
PyObject *get_byte()
#else
PyObject *get_char()
#endif
{
PYW_GIL_CHECK_LOCKED_SCOPE();
int ch;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
ch = qlgetc(li);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ch == EOF )
Py_RETURN_NONE;
#ifdef PY3
return Py_BuildValue("i", ch);
#else
return Py_BuildValue("c", ch);
#endif
}
};
//</inline(py_idaapi_loader_input)>
+1 -1
View File
@@ -38,7 +38,7 @@ inline PyObject *get_mark_comment(int32 slot)
renderer_info_t ri;
lochist_entry_t loc(&ip, ri);
if ( bookmarks_t::get_desc(&desc, loc, slot, nullptr) )
return IDAPyStr_FromUTF8(desc.c_str());
return PyUnicode_FromString(desc.c_str());
else
Py_RETURN_NONE;
}
+8 -8
View File
@@ -54,7 +54,7 @@ PyObject *py_appcall(
error_t ret;
idc_value_t idc_result;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
if ( (debug & IDA_DEBUG_APPCALL) != 0 )
{
@@ -78,7 +78,7 @@ PyObject *py_appcall(
idc_args.begin(),
idc_args.size());
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ret != eOk )
{
@@ -188,7 +188,7 @@ static PyObject *dbg_get_registers()
for ( int i=0; i < nbits; i++ )
{
const char *s = ri.bit_strings[i];
PyList_SetItem(py_bits, i, IDAPyStr_FromUTF8(s == nullptr ? "" : s));
PyList_SetItem(py_bits, i, PyUnicode_FromString(s == nullptr ? "" : s));
}
}
else
@@ -255,14 +255,14 @@ static PyObject *dbg_read_memory(ea_t ea, size_t sz)
Py_RETURN_NONE;
// Create a Python string
PyObject *ret = IDAPyBytes_FromMemAndSize(nullptr, Py_ssize_t(sz));
PyObject *ret = PyBytes_FromStringAndSize(nullptr, Py_ssize_t(sz));
if ( ret == nullptr )
Py_RETURN_NONE;
// Get the internal buffer
Py_ssize_t len;
char *buf;
IDAPyBytes_AsMemAndSize(ret, &buf, &len);
PyBytes_AsStringAndSize(ret, &buf, &len);
if ( size_t(read_dbg_memory(ea, buf, sz)) != sz )
{
Py_DECREF(ret);
@@ -314,7 +314,7 @@ static PyObject *dbg_get_name()
if ( dbg == nullptr )
Py_RETURN_NONE;
else
return IDAPyStr_FromUTF8(dbg->name);
return PyUnicode_FromString(dbg->name);
}
//-------------------------------------------------------------------------
@@ -339,12 +339,12 @@ static PyObject *dbg_get_memory_info()
// Invalidate memory
meminfo_vec_t ranges;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
invalidate_dbgmem_config();
invalidate_dbgmem_contents(BADADDR, BADADDR);
get_dbg_memory_info(&ranges);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return meminfo_vec_t_to_py(ranges);
}
+30 -26
View File
@@ -35,7 +35,7 @@ static PyObject *AssembleLine(
int inslen = processor_t::assemble((uchar *)buf, ea, cs, ip, use32, line);
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( inslen > 0 )
return IDAPyBytes_FromMemAndSize(buf, inslen);
return PyBytes_FromStringAndSize(buf, inslen);
else
Py_RETURN_NONE;
}
@@ -66,14 +66,14 @@ bool assemble(
char buf[MAXSTR];
PYW_GIL_CHECK_LOCKED_SCOPE();
bool rc = false;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
int inslen = processor_t::assemble((uchar *)buf, ea, cs, ip, use32, line);
if ( inslen > 0 )
{
patch_bytes(ea, buf, inslen);
rc = true;
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -329,7 +329,7 @@ static PyObject *ph_get_regnames()
processor_t &ph = PH;
PyObject *py_result = PyList_New(ph.regs_num);
for ( Py_ssize_t i=0; i < ph.regs_num; i++ )
PyList_SetItem(py_result, i, IDAPyStr_FromUTF8(ph.reg_names[i]));
PyList_SetItem(py_result, i, PyUnicode_FromString(ph.reg_names[i]));
return py_result;
}
@@ -360,7 +360,7 @@ static PyObject *ph_get_operand_info(
PYW_GIL_CHECK_LOCKED_SCOPE();
bool ok = false;
idd_opinfo_t opinf;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
do
{
if ( dbg == nullptr || n == - 1 )
@@ -388,7 +388,7 @@ static PyObject *ph_get_operand_info(
ok = true;
} while (false);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ok )
return Py_BuildValue("(i" PY_BV_EA "Kii)",
opinf.modified,
@@ -441,8 +441,8 @@ struct IDP_Hooks : public hooks_base_t
{
// hookgenIDP:methodsinfo_decl
IDP_Hooks(uint32 _flags=0)
: hooks_base_t("ida_idp.IDP_Hooks", IDP_Callback, HT_IDP, _flags) {}
IDP_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL)
: hooks_base_t("ida_idp.IDP_Hooks", IDP_Callback, HT_IDP, _flags, _hkcb_flags) {}
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
@@ -470,11 +470,15 @@ protected:
switch ( value_type )
{
case IDPOPT_STR:
return IDAPyStr_FromUTF8((const char *) value);
return PyUnicode_FromString((const char *) value);
case IDPOPT_NUM:
return IDAPyInt_FromLong(*(const uval_t *) value);
#ifdef __EA64__
return PyLong_FromLongLong(*(const uval_t *) value);
#else
return PyLong_FromLong(*(const uval_t *) value);
#endif
case IDPOPT_BIT:
return IDAPyInt_FromLong(*(const int *) value);
return PyLong_FromLong(*(const int *) value);
case IDPOPT_I64:
return PyLong_FromLongLong(*(const int64 *) value);
default:
@@ -488,9 +492,9 @@ private:
static ssize_t cm_t_to_ssize_t(cm_t cm) { return ssize_t(cm); }
static bool _handle_qstring_output(PyObject *o, qstring *buf)
{
bool is_str = o != nullptr && IDAPyStr_Check(o);
bool is_str = o != nullptr && PyUnicode_Check(o);
if ( is_str && buf != nullptr )
IDAPyStr_AsUTF8(buf, o);
PyUnicode_as_qstring(buf, o);
Py_XDECREF(o);
return is_str;
}
@@ -508,11 +512,11 @@ private:
const char * /*line*/)
{
ssize_t rc = 0;
if ( o != nullptr && IDAPyBytes_Check(o) )
if ( o != nullptr && PyBytes_Check(o) )
{
char *s;
Py_ssize_t len = 0;
if ( IDAPyBytes_AsMemAndSize(o, &s, &len) != -1 )
if ( PyBytes_AsStringAndSize(o, &s, &len) != -1 )
{
if ( len > MAXSTR )
len = MAXSTR;
@@ -561,10 +565,10 @@ private:
{
newref_t py_rc(PySequence_GetItem(o, 0));
newref_t py_idx(PySequence_GetItem(o, 1));
if ( IDAPyInt_Check(py_rc.o) && IDAPyInt_Check(py_idx.o) )
if ( PyLong_Check(py_rc.o) && PyLong_Check(py_idx.o) )
{
rc = IDAPyInt_AsLong(py_rc.o);
*idx = IDAPyInt_AsLong(py_idx.o);
rc = PyLong_AsLong(py_rc.o);
*idx = PyLong_AsLong(py_idx.o);
}
}
return rc;
@@ -584,13 +588,13 @@ private:
newref_t py_out(PySequence_GetItem(o, 1));
newref_t py_out_res(PySequence_GetItem(o, 2));
qstring qs;
if ( IDAPyInt_Check(py_rc.o)
&& IDAPyInt_Check(py_out_res.o)
&& IDAPyStr_Check(py_out.o)
&& IDAPyStr_AsUTF8(&qs, py_out.o) )
if ( PyLong_Check(py_rc.o)
&& PyLong_Check(py_out_res.o)
&& PyUnicode_Check(py_out.o)
&& PyUnicode_as_qstring(&qs, py_out.o) )
{
rc = IDAPyInt_AsLong(py_rc.o);
*out_res = IDAPyInt_AsLong(py_out_res.o);
rc = PyLong_AsLong(py_rc.o);
*out_res = PyLong_AsLong(py_out_res.o);
if ( out != nullptr )
out->swap(qs);
}
@@ -614,7 +618,7 @@ private:
qstring *buf,
const insn_t * /*pinsn*/)
{
return IDAPyStr_Check(o) && IDAPyStr_AsUTF8(buf, o);
return PyUnicode_Check(o) && PyUnicode_as_qstring(buf, o);
}
static ssize_t handle_get_operand_string_output(
PyObject *o,
@@ -622,7 +626,7 @@ private:
const insn_t * /*pinsn*/,
int /*opnum*/)
{
return IDAPyStr_Check(o) && IDAPyStr_AsUTF8(buf, o);
return PyUnicode_Check(o) && PyUnicode_as_qstring(buf, o);
}
};
+2 -2
View File
@@ -9,8 +9,8 @@ struct IDB_Hooks : public hooks_base_t
{
// hookgenIDB:methodsinfo_decl
IDB_Hooks(uint32 _flags=0)
: hooks_base_t("ida_idp.IDB_Hooks", IDB_Callback, HT_IDB, _flags) {}
IDB_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL)
: hooks_base_t("ida_idp.IDB_Hooks", IDB_Callback, HT_IDB, _flags, _hkcb_flags) {}
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
+30 -27
View File
@@ -65,7 +65,7 @@ static PyObject *py_register_timer(int interval, PyObject *py_callback)
py_timer_ctx_t *ctx = (py_timer_ctx_t *)ud;
newref_t py_result(PyObject_CallFunctionObjArgs(ctx->pyfunc.o, nullptr));
int ret = -1;
if ( PyErr_Occurred() )
if ( PyErr_Occurred() != nullptr )
{
msg("Exception in timer callback. This timer will be unregistered.\n");
PyErr_Print();
@@ -152,7 +152,7 @@ static PyObject *py_choose_idasgn()
}
else
{
PyObject *py_str = IDAPyStr_FromUTF8(name);
PyObject *py_str = PyUnicode_FromString(name);
qfree(name);
return py_str;
}
@@ -196,7 +196,7 @@ static int py_load_custom_icon_data(PyObject *data, const char *format)
Py_ssize_t len;
char *s;
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( IDAPyBytes_AsMemAndSize(data, &s, &len) == -1 )
if ( PyBytes_AsStringAndSize(data, &s, &len) == -1 )
return 0;
else
return load_custom_icon(s, len, format);
@@ -274,9 +274,9 @@ static PyObject *py_msg(PyObject *o)
return nullptr;
}
int rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = msg("%s", utf8);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return PyInt_FromLong(rc);
}
@@ -304,7 +304,7 @@ PyObject *py_ask_text(size_t max_size, const char *defval, const char *prompt)
PyObject *py_ret;
if ( ask_text(&qbuf, max_size, defval, "%s", prompt) )
{
py_ret = IDAPyStr_FromUTF8AndSize(qbuf.begin(), qbuf.length());
py_ret = PyUnicode_FromStringAndSize(qbuf.begin(), qbuf.length());
}
else
{
@@ -336,7 +336,7 @@ PyObject *py_ask_str(qstring *defval, int hist, const char *prompt)
PyObject *py_ret;
if ( ask_str(defval, hist, "%s", prompt) )
{
py_ret = IDAPyStr_FromUTF8AndSize(defval->begin(), defval->length());
py_ret = PyUnicode_FromStringAndSize(defval->begin(), defval->length());
}
else
{
@@ -588,9 +588,9 @@ static int py_execute_sync(PyObject *py_callable, int reqf)
{
PYW_GIL_GET;
newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, nullptr));
int ret = py_result == nullptr || !IDAPyInt_Check(py_result.o)
int ret = py_result == nullptr || !PyLong_Check(py_result.o)
? -1
: IDAPyInt_AsLong(py_result.o);
: PyLong_AsLong(py_result.o);
// if the requesting thread decided not to wait for the request to
// complete, we have to self-destroy, nobody else will do it
if ( (code & MFF_NOWAIT) != 0 )
@@ -616,9 +616,9 @@ static int py_execute_sync(PyObject *py_callable, int reqf)
// Release GIL before executing, or if this is running in the
// non-main thread, this will wait on the req.sem, while the main
// thread might be waiting for the GIL to be available.
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = execute_sync(*req, reqf);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
// destroy the request once it is finished. exception: NOWAIT requests
// will be handled in the future, so do not destroy them yet!
if ( (reqf & MFF_NOWAIT) == 0 )
@@ -686,7 +686,7 @@ static bool py_execute_ui_requests(PyObject *py_list)
// trickling all the way up to the Python runtime.
// Since it would interfere with subsequent Python code execution, we
// want to report it right away.
if ( PyErr_Occurred() )
if ( PyErr_Occurred() != nullptr )
{
PyErr_Print();
return false;
@@ -811,7 +811,7 @@ public:
{
newref_t str(PyObject_CallFunction(json_dumps.o, "O", dict));
qstring buf;
if ( IDAPyStr_AsUTF8(&buf, str.o) )
if ( PyUnicode_as_qstring(&buf, str.o) )
{
jvalue_t tmp;
if ( parse_json_string(&tmp, buf.c_str()) == eOk )
@@ -836,8 +836,8 @@ struct UI_Hooks : public hooks_base_t
{
// hookgenUI:methodsinfo_decl
UI_Hooks(uint32 _flags=0)
: hooks_base_t("ida_kernwin.UI_Hooks", UI_Callback, HT_UI, _flags) {}
UI_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL)
: hooks_base_t("ida_kernwin.UI_Hooks", UI_Callback, HT_UI, _flags, _hkcb_flags) {}
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
@@ -861,7 +861,7 @@ private:
static ssize_t handle_get_ea_hint_output(PyObject *o, qstring *buf, ea_t)
{
ssize_t rc = 0;
if ( o != nullptr && IDAPyStr_Check(o) && IDAPyStr_AsUTF8(buf, o) )
if ( o != nullptr && PyUnicode_Check(o) && PyUnicode_as_qstring(buf, o) )
rc = 1;
Py_XDECREF(o);
return rc;
@@ -874,14 +874,14 @@ private:
borref_t el0(PyTuple_GetItem(o, 0));
qstring plug_hint;
if ( el0 != nullptr
&& IDAPyStr_Check(el0.o)
&& IDAPyStr_AsUTF8(&plug_hint, el0.o)
&& PyUnicode_Check(el0.o)
&& PyUnicode_as_qstring(&plug_hint, el0.o)
&& !plug_hint.empty() )
{
borref_t el1(PyTuple_GetItem(o, 1));
if ( el1 != nullptr && IDAPyInt_Check(el1.o) )
if ( el1 != nullptr && PyLong_Check(el1.o) )
{
long lns = IDAPyInt_AsLong(el1.o);
long lns = PyLong_AsLong(el1.o);
if ( lns > 0 )
{
if ( !hint->empty() && hint->last() != '\n' )
@@ -959,7 +959,7 @@ PyObject *py_get_registered_actions()
/*
#<pydoc>
def py_attach_dynamic_action_to_popup(
widget,
unused,
popup_handle,
desc,
popuppath = None,
@@ -973,7 +973,7 @@ def py_attach_dynamic_action_to_popup(
desc = idaapi.action_desc_t(None, 'Dynamic popup action', Handler())
idaapi.attach_dynamic_action_to_popup(form, popup, desc)
@param widget: target widget
@param unused: deprecated; should be None
@param popup_handle: target popup
@param desc: action description of type action_desc_t
@param popuppath: can be None
@@ -984,14 +984,17 @@ def py_attach_dynamic_action_to_popup(
#</pydoc>
*/
bool py_attach_dynamic_action_to_popup(
TWidget *widget,
TWidget *unused,
TPopupMenu *popup_handle,
action_desc_t *desc,
const char *popuppath = nullptr,
int flags = 0)
{
qnotused(unused);
if ( popup_handle == nullptr || desc == nullptr )
return false;
bool ok = attach_dynamic_action_to_popup(
widget, popup_handle, *desc, popuppath, flags);
nullptr, popup_handle, *desc, popuppath, flags);
// If attaching
// * succeeded: the action (and its handler) will be deleted after
// the popup is dismissed,
@@ -1042,7 +1045,7 @@ static PyObject *py_chooser_base_t_get_row(
PyObject *tuple = PyTuple_New(3);
PyTuple_SetItem(tuple, 0, qstrvec2pylist(fields));
PyTuple_SetItem(tuple, 1, IDAPyInt_FromLong(icon));
PyTuple_SetItem(tuple, 1, PyLong_FromLong(icon));
PyObject *py_attrs = SWIG_NewPointerObj(
SWIG_as_voidptr(attrs),
SWIGTYPE_p_chooser_item_attrs_t,
@@ -1119,7 +1122,7 @@ PyObject *py_set_nav_colorizer(PyObject *new_py_colorizer)
{
int overflow = 0;
const long l = PyLong_AsLongAndOverflow(pyres.o, &overflow);
ok = !PyErr_Occurred();
ok = PyErr_Occurred() == nullptr;
if ( ok )
{
if ( l == -1 && overflow != 0 )
@@ -1267,7 +1270,7 @@ static PyObject *py_add_spaces(const char *s, size_t len)
// we use the actual 'size' because we know that
// 'add_spaces()' will add a terminating zero anyway
add_spaces(qbuf.begin(), qbuf.size(), len);
return IDAPyStr_FromUTF8(qbuf.c_str());
return PyUnicode_FromString(qbuf.c_str());
}
//-------------------------------------------------------------------------
+2 -1
View File
@@ -112,7 +112,7 @@ class quick_widget_commands_t:
cmd.shortcut,
None,
cmd.icon)
attach_dynamic_action_to_popup(widget, popup, desc)
attach_dynamic_action_to_popup(None, popup, desc)
class disabled_script_timeout_t(object):
def __enter__(self):
@@ -134,5 +134,6 @@ ida_ida.__wrap_hooks_callback(
# ----------------------------------------------------------------------
# bw-compat/deprecated. You shouldn't rely on this in new code
from ida_pro import str2user
SETMENU_IF_ENABLED = 4
#</pycode(py_kernwin)>
+7 -7
View File
@@ -151,7 +151,7 @@ static PyObject *formchgcbfa_get_field_value(
{
qstring val;
if ( fa->get_combobox_value(fid, &val) )
return IDAPyStr_FromUTF8(val.c_str());
return PyUnicode_FromString(val.c_str());
}
break;
@@ -184,7 +184,7 @@ static PyObject *formchgcbfa_get_field_value(
{
char val[MAXSTR];
if ( fa->get_string_value(fid, val, sizeof(val)) )
return IDAPyStr_FromUTF8(val);
return PyUnicode_FromString(val);
break;
}
// string input
@@ -193,7 +193,7 @@ static PyObject *formchgcbfa_get_field_value(
qstring val;
val.resize(sz + 1);
if ( fa->get_string_value(fid, val.begin(), val.size()) )
return IDAPyStr_FromUTF8(val.begin());
return PyUnicode_FromString(val.begin());
break;
}
case 5:
@@ -215,7 +215,7 @@ static PyObject *formchgcbfa_get_field_value(
sel_t sel;
sval_t sval;
uval_t uval;
ulonglong ull;
uint64 ull;
} u;
switch ( sz )
{
@@ -268,10 +268,10 @@ static bool formchgcbfa_set_field_value(
// dropdown list
case 8:
// Editable dropdown list
if ( IDAPyStr_Check(py_val) )
if ( PyUnicode_Check(py_val) )
{
qstring val;
IDAPyStr_AsUTF8(&val, py_val);
PyUnicode_as_qstring(&val, py_val);
return fa->set_combobox_value(fid, &val);
}
// Readonly dropdown list
@@ -305,7 +305,7 @@ static bool formchgcbfa_set_field_value(
case 1:
{
qstring val;
IDAPyStr_AsUTF8(&val, py_val);
PyUnicode_as_qstring(&val, py_val);
return fa->set_string_value(fid, val.c_str());
}
// intvec_t
+4 -4
View File
@@ -179,13 +179,13 @@ class Form(object):
Factory method returning a ctype class corresponding to the field type string
"""
if tp in (Form.FT_SEG, Form.FT_HEX, Form.FT_RAWHEX, Form.FT_ADDR):
return ctypes.c_ulonglong if i64 else ctypes.c_ulong
return ctypes.c_uint64 if i64 else ctypes.c_ulong
elif tp in (Form.FT_SHEX, Form.FT_DEC, Form.FT_OCT, Form.FT_BIN, Form.FT_CHAR):
return ctypes.c_longlong if i64 else ctypes.c_long
return ctypes.c_int64 if i64 else ctypes.c_long
elif tp == Form.FT_UINT64:
return ctypes.c_ulonglong
return ctypes.c_uint64
elif tp == Form.FT_INT64:
return ctypes.c_longlong
return ctypes.c_int64
elif tp == Form.FT_COLOR:
return ctypes.c_ulong
elif tp == Form._FT_USHORT:
+13 -13
View File
@@ -154,8 +154,8 @@ bool py_chooser_props_t::do_extract_from_pyobject(
if ( flags_attr == nullptr )
RETERR("Missing or invalid mandatory '%s' attribute", S_FLAGS);
if ( IDAPyInt_Check(flags_attr.o) )
out->flags = uint32(IDAPyInt_AsLong(flags_attr.o));
if ( PyLong_Check(flags_attr.o) )
out->flags = uint32(PyLong_AsLong(flags_attr.o));
// instruct TChooser destructor to delete this chooser when widget
// closes
out->flags &= ~CH_KEEP;
@@ -180,7 +180,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// Extract string
if ( v != nullptr )
IDAPyStr_AsUTF8(&out->header_strings[i], v.o);
PyUnicode_as_qstring(&out->header_strings[i], v.o);
out->header[i] = out->header_strings[i].c_str();
// Extract width
@@ -205,7 +205,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
for ( Py_ssize_t i = 0; i < npopups; ++i )
{
qstring &buf = out->popup_names.push_back();
IDAPyStr_AsUTF8(&buf, PyList_GetItem(pn_attr.o, i));
PyUnicode_as_qstring(&buf, PyList_GetItem(pn_attr.o, i));
}
}
@@ -236,8 +236,8 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// we can forbid some callbacks explicitly
uint32 forbidden_cb = 0;
ref_t forbidden_cb_attr(PyW_TryGetAttrString(o, "forbidden_cb"));
if ( forbidden_cb_attr != nullptr && IDAPyInt_Check(forbidden_cb_attr.o) )
forbidden_cb = uint32(IDAPyInt_AsLong(forbidden_cb_attr.o));
if ( forbidden_cb_attr != nullptr && PyLong_Check(forbidden_cb_attr.o) )
forbidden_cb = uint32(PyLong_AsLong(forbidden_cb_attr.o));
out->features = 0;
for ( int i = 0; i < qnumber(callbacks); ++i )
@@ -371,14 +371,14 @@ void py_chooser_mixin_t::mixin_get_row(
newref_t item(PySequence_GetItem(list.result.o, Py_ssize_t(i)));
if ( item != nullptr )
{
if ( !IDAPyStr_Check(item.o) )
if ( !PyUnicode_Check(item.o) )
{
PyErr_Format(
PyExc_TypeError,
"Expected 'str' data for row %" FMT_Z ", column %d", n, i);
break;
}
IDAPyStr_AsUTF8(&cols->at(i), item.o);
PyUnicode_as_qstring(&cols->at(i), item.o);
}
}
}
@@ -550,14 +550,14 @@ class py_chooser_t : public chooser_t, public py_chooser_mixin_t
{
{
newref_t item(PySequence_GetItem(pyres.result.o, 0));
if ( item.o != nullptr && IDAPyInt_Check(item.o) )
ret.changed = cbres_t(IDAPyInt_AsLong(item.o));
if ( item.o != nullptr && PyLong_Check(item.o) )
ret.changed = cbres_t(PyLong_AsLong(item.o));
}
if ( ret.changed != NOTHING_CHANGED )
{
newref_t item(PySequence_GetItem(pyres.result.o, 1));
if ( item.o != nullptr && IDAPyInt_Check(item.o) )
ret.idx = ssize_t(IDAPyInt_AsSsize_t(item.o));
if ( item.o != nullptr && PyLong_Check(item.o) )
ret.idx = ssize_t(PyLong_AsSsize_t(item.o));
}
}
*out = ret;
@@ -870,7 +870,7 @@ PyObject *py_get_chooser_data(const char *chooser_caption, int n)
Py_RETURN_NONE;
PyObject *py_list = PyList_New(data.size());
for ( size_t i = 0; i < data.size(); ++i )
PyList_SetItem(py_list, i, IDAPyStr_FromUTF8(data[i].c_str()));
PyList_SetItem(py_list, i, PyUnicode_FromString(data[i].c_str()));
return py_list;
}
+4 -4
View File
@@ -124,8 +124,8 @@ private:
if ( sz > 0 )
{
borref_t _r(PyTuple_GetItem(result.o, 0));
if ( _r != nullptr && IDAPyStr_Check(_r.o) )
IDAPyStr_AsUTF8(line, _r.o);
if ( _r != nullptr && PyUnicode_Check(_r.o) )
PyUnicode_as_qstring(line, _r.o);
}
#define GET_TUPLE_ENTRY(col, PyThingy, AsThingy, out) \
@@ -171,10 +171,10 @@ private:
line,
x));
bool ok = result != nullptr && IDAPyStr_Check(result.o);
bool ok = result != nullptr && PyUnicode_Check(result.o);
PyW_ShowCbErr(S_ON_COMPLETE_LINE);
if ( ok )
IDAPyStr_AsUTF8(completion, result.o);
PyUnicode_as_qstring(completion, result.o);
return ok;
}
+12 -10
View File
@@ -209,16 +209,16 @@ class py_simplecustview_t
//-------------------------------------------------------------------------
static bool get_color(uint32 *out, ref_t obj)
{
bool ok = PyLong_Check(obj.o);
bool ok = PyLong_Check(obj.o) != 0;
if ( ok )
{
*out = uint32(PyLong_AsUnsignedLong(obj.o));
}
else
{
ok = IDAPyInt_Check(obj.o) != 0;
ok = PyLong_Check(obj.o) != 0;
if ( ok )
*out = uint32(IDAPyInt_AsLong(obj.o));
*out = uint32(PyLong_AsLong(obj.o));
}
return ok;
}
@@ -229,9 +229,9 @@ class py_simplecustview_t
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( IDAPyStr_Check(py) )
if ( PyUnicode_Check(py) )
{
IDAPyStr_AsUTF8(&sl.line, py);
PyUnicode_as_qstring(&sl.line, py);
return true;
}
Py_ssize_t sz;
@@ -239,10 +239,10 @@ class py_simplecustview_t
return false;
PyObject *py_val = PyTuple_GetItem(py, 0);
if ( !IDAPyStr_Check(py_val) )
if ( !PyUnicode_Check(py_val) )
return false;
IDAPyStr_AsUTF8(&sl.line, py_val);
PyUnicode_as_qstring(&sl.line, py_val);
uint32 col;
if ( sz > 1 && get_color(&col, borref_t(PyTuple_GetItem(py, 1))) )
sl.color = color_t(col);
@@ -336,7 +336,7 @@ class py_simplecustview_t
{
if ( important_lines != nullptr )
*important_lines = PyInt_AsLong(PyTuple_GetItem(py_result.o, 0));
IDAPyStr_AsUTF8(&hint, PyTuple_GetItem(py_result.o, 1));
PyUnicode_as_qstring(&hint, PyTuple_GetItem(py_result.o, 1));
}
return ok;
}
@@ -708,6 +708,8 @@ public:
PyObject *pyscv_init(PyObject *py_link, const char *title)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( py_link == nullptr )
Py_RETURN_NONE;
py_simplecustview_t *_this = new py_simplecustview_t();
bool ok = _this->init(py_link, title);
if ( !ok )
@@ -737,7 +739,7 @@ PyObject *pyscv_get_current_line(PyObject *py_this, bool mouse, bool notags)
_this->get_current_line(&line, mouse, notags);
if ( line.empty() )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8AndSize(line.c_str(), line.length());
return PyUnicode_FromStringAndSize(line.c_str(), line.length());
}
//--------------------------------------------------------------------------
@@ -857,7 +859,7 @@ PyObject *pyscv_get_current_word(PyObject *py_this, bool mouse)
{
qstring word;
if ( _this->get_current_word(mouse, word) )
return IDAPyStr_FromUTF8(word.c_str());
return PyUnicode_FromString(word.c_str());
}
Py_RETURN_NONE;
}
+2 -2
View File
@@ -9,8 +9,8 @@ struct View_Hooks : public hooks_base_t
{
// hookgenVIEW:methodsinfo_decl
View_Hooks(uint32 _flags=0)
: hooks_base_t("ida_kernwin.View_Hooks", View_Callback, HT_VIEW, _flags) {}
View_Hooks(uint32 _flags=0, uint32 _hkcb_flags=HKCB_GLOBAL)
: hooks_base_t("ida_kernwin.View_Hooks", View_Callback, HT_VIEW, _flags, _hkcb_flags) {}
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
+4 -4
View File
@@ -21,7 +21,7 @@ static void idaapi s_py_get_user_defined_prefix(
// Error? Display it
// No error? Copy the buffer
if ( !PyW_ShowCbErr("py_get_user_defined_prefix") )
IDAPyStr_AsUTF8(buf, py_ret.o);
PyUnicode_as_qstring(buf, py_ret.o);
}
//</code(py_lines)>
@@ -77,7 +77,7 @@ PyObject *py_tag_remove(const char *str)
PYW_GIL_CHECK_LOCKED_SCOPE();
qstring qbuf;
tag_remove(&qbuf, str);
return IDAPyStr_FromUTF8(qbuf.c_str());
return PyUnicode_FromString(qbuf.c_str());
}
//-------------------------------------------------------------------------
@@ -86,7 +86,7 @@ PyObject *py_tag_addr(ea_t ea)
qstring tag;
tag_addr(&tag, ea);
PYW_GIL_CHECK_LOCKED_SCOPE();
return IDAPyStr_FromUTF8(tag.begin());
return PyUnicode_FromString(tag.begin());
}
//-------------------------------------------------------------------------
@@ -150,7 +150,7 @@ PyObject *py_generate_disassembly(
tag_remove(&qbuf, l);
s = qbuf.c_str();
}
PyList_SetItem(py_list.o, i, IDAPyStr_FromUTF8(s));
PyList_SetItem(py_list.o, i, PyUnicode_FromString(s));
}
return Py_BuildValue("(iO)", lnnum, py_list.o);
}
+3 -3
View File
@@ -27,7 +27,7 @@ static int py_mem2base(PyObject *py_mem, ea_t ea, qoff64_t fpos = -1)
char *buf;
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( IDAPyBytes_AsMemAndSize(py_mem, &buf, &len) == -1 )
if ( PyBytes_AsStringAndSize(py_mem, &buf, &len) == -1 )
return 0;
}
@@ -83,9 +83,9 @@ static bool py_run_plugin(PyObject *plg, size_t arg)
{
plugin_t *p = (plugin_t *) PyCapsule_GetPointer(plg, VALID_CAPSULE_NAME);
bool rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
rc = run_plugin(p, arg);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ PyObject *py_split_metadata(const metadata_t &md)
while ( p.next() )
{
newref_t py_key(PyInt_FromLong(p.key));
newref_t py_value(IDAPyBytes_FromMemAndSize((const char *) p.data, p.size));
newref_t py_value(PyBytes_FromStringAndSize((const char *) p.data, p.size));
// PyDict_SetItem doesn't "steal" references; hence the 'newref_t's above.
PyDict_SetItem(py_dict, py_key.o, py_value.o);
}
+2 -2
View File
@@ -26,7 +26,7 @@ static int idaapi py_import_enum_cb(
if ( name == nullptr )
py_name = borref_t(Py_None);
else
py_name = newref_t(IDAPyStr_FromUTF8(name));
py_name = newref_t(PyUnicode_FromString(name));
newref_t py_ord(Py_BuildValue(PY_BV_UVAL, bvuval_t(ord)));
newref_t py_ea(Py_BuildValue(PY_BV_EA, bvea_t(ea)));
@@ -61,7 +61,7 @@ static PyObject *py_get_import_module_name(int mod_index)
if ( !get_import_module_name(&qbuf, mod_index) )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8AndSize(qbuf.begin(), qbuf.length());
return PyUnicode_FromStringAndSize(qbuf.begin(), qbuf.length());
}
//-------------------------------------------------------------------------
+4 -4
View File
@@ -10,9 +10,9 @@ PyObject *get_debug_names(ea_t ea1, ea_t ea2, bool return_list=false)
// Get debug names
ea_name_vec_t names;
PYW_GIL_CHECK_LOCKED_SCOPE();
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
get_debug_names(&names, ea1, ea2);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
PyObject *dict = Py_BuildValue("{}");
if ( dict != nullptr )
{
@@ -20,7 +20,7 @@ PyObject *get_debug_names(ea_t ea1, ea_t ea2, bool return_list=false)
PyObject *list = nullptr;
for ( ea_name_vec_t::iterator it = names.begin(); it != names.end(); ++it )
{
PyObject *name_obj = IDAPyStr_FromUTF8(it->name.c_str());
PyObject *name_obj = PyUnicode_FromString(it->name.c_str());
if ( it->ea != last_ea )
{
if ( return_list )
@@ -49,7 +49,7 @@ PyObject *py_validate_name(const char *name, nametype_t type, int flags=0)
{
qstring qname(name);
if ( validate_name(&qname, type, flags) )
return IDAPyStr_FromUTF8AndSize(qname.c_str(), qname.length());
return PyUnicode_FromStringAndSize(qname.c_str(), qname.length());
else
Py_RETURN_NONE;
}
+2 -2
View File
@@ -58,7 +58,7 @@ static PyObject *qstrvec_t_get(PyObject *self, size_t idx)
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == nullptr || idx >= sv->size() )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8(sv->at(idx).c_str());
return PyUnicode_FromString(sv->at(idx).c_str());
}
static bool qstrvec_t_add(PyObject *self, const char *s)
@@ -125,6 +125,6 @@ PyObject *py_str2user(const char *str)
Py_RETURN_NONE;
qstring retstr;
qstr2user(&retstr, str);
return IDAPyStr_FromUTF8(retstr.c_str());
return PyUnicode_FromString(retstr.c_str());
}
//</inline(py_pro)>
+7 -6
View File
@@ -2,11 +2,12 @@
#<pycode(py_pro)>
import ida_idaapi
int64vec_t = longlongvec_t
uint64vec_t = ulonglongvec_t
longlongvec_t = int64vec_t
ulonglongvec_t = uint64vec_t
if ida_idaapi.__EA64__:
svalvec_t = longlongvec_t
uvalvec_t = ulonglongvec_t
svalvec_t = int64vec_t
uvalvec_t = uint64vec_t
else:
svalvec_t = intvec_t
uvalvec_t = uintvec_t
@@ -15,8 +16,8 @@ eavec_t = uvalvec_t
ida_idaapi._listify_types(
intvec_t,
uintvec_t,
longlongvec_t,
ulonglongvec_t,
int64vec_t,
uint64vec_t,
boolvec_t,
strvec_t)
+15 -15
View File
@@ -9,15 +9,15 @@ static PyObject *_py_reg_subkey_children(const char *name, bool subkeys)
PYW_GIL_CHECK_LOCKED_SCOPE();
PyObject *result = nullptr;
qstrvec_t children;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
if ( reg_subkey_children(&children, name, subkeys) )
{
result = PyList_New(children.size());
if ( result != nullptr )
for ( size_t i = 0, n = children.size(); i < n; ++i )
PyList_SET_ITEM(result, i, IDAPyStr_FromUTF8(children[i].c_str()));
PyList_SET_ITEM(result, i, PyUnicode_FromString(children[i].c_str()));
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( result == nullptr )
Py_RETURN_NONE;
else
@@ -32,11 +32,11 @@ PyObject *py_reg_read_string(const char *name, const char *subkey = nullptr, con
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qstring utf8;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
if ( !reg_read_string(&utf8, name, subkey) && def != nullptr )
utf8 = def;
Py_END_ALLOW_THREADS;
return IDAPyStr_FromUTF8(utf8.c_str());
SWIG_PYTHON_THREAD_END_ALLOW;
return PyUnicode_FromString(utf8.c_str());
}
//-------------------------------------------------------------------------
@@ -44,9 +44,9 @@ regval_type_t py_reg_data_type(const char *name, const char *subkey = nullptr)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
regval_type_t rt = reg_unknown;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
reg_data_type(&rt, name, subkey);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rt;
}
@@ -56,11 +56,11 @@ PyObject *py_reg_read_binary(const char *name, const char *subkey = nullptr)
PYW_GIL_CHECK_LOCKED_SCOPE();
bytevec_t bytes;
bool ok;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
ok = reg_read_binary(name, &bytes, subkey);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ok )
return IDAPyBytes_FromMemAndSize((const char *) bytes.begin(), bytes.size());
return PyBytes_FromStringAndSize((const char *) bytes.begin(), bytes.size());
else
Py_RETURN_NONE;
}
@@ -69,16 +69,16 @@ PyObject *py_reg_read_binary(const char *name, const char *subkey = nullptr)
PyObject *py_reg_write_binary(const char *name, PyObject *py_bytes, const char *subkey = nullptr)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( IDAPyBytes_Check(py_bytes) )
if ( PyBytes_Check(py_bytes) )
{
char *py_bytes_raw = nullptr;
Py_ssize_t py_size = 0;
IDAPyBytes_AsMemAndSize(py_bytes, &py_bytes_raw, &py_size);
PyBytes_AsStringAndSize(py_bytes, &py_bytes_raw, &py_size);
bytevec_t bytes;
bytes.append(py_bytes_raw, py_size);
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
reg_write_binary(name, bytes.begin(), bytes.size(), subkey);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
Py_RETURN_NONE;
}
else
+28 -2
View File
@@ -36,14 +36,40 @@ ea_t segment_t_end_ea_get(segment_t *segm)
//</code(py_segment)>
//<inline(py_segment)>
//--------------------------------------------------------------------------
/*
#<pydoc>
def get_defsr(s, reg):
"""
Deprecated, use instead:
value = s.defsr[reg]
"""
pass
#</pydoc>
*/
sel_t get_defsr(segment_t *s, int reg)
{
return s->defsr[reg];
return s != nullptr && reg >= 0 && reg < SREG_NUM ? s->defsr[reg] : BADSEL;
}
//--------------------------------------------------------------------------
/*
#<pydoc>
def set_defsr(s, reg, value):
"""
Deprecated, use instead:
s.defsr[reg] = value
"""
pass
#</pydoc>
*/
void set_defsr(segment_t *s, int reg, sel_t value)
{
s->defsr[reg] = value;
if ( s != nullptr && reg >= 0 && reg < SREG_NUM )
s->defsr[reg] = value;
}
//--------------------------------------------------------------------------
int py_rebase_program(PyObject *delta, int flags)
{
int rc = MOVE_SEGM_PARAM;
+27 -33
View File
@@ -39,17 +39,17 @@ def calc_type_size(ti, tp):
PyObject *py_calc_type_size(const til_t *ti, PyObject *tp)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( IDAPyBytes_Check(tp) )
if ( PyBytes_Check(tp) )
{
// To avoid release of 'data' during Py_BEGIN|END_ALLOW_THREADS section.
borref_t tpref(tp);
const type_t *data = (type_t *)IDAPyBytes_AsString(tp);
const type_t *data = (type_t *)PyBytes_AsString(tp);
size_t sz;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
tif.deserialize(ti, &data, nullptr, nullptr);
sz = tif.get_size();
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( sz != BADSIZE )
return PyInt_FromLong(sz);
Py_RETURN_NONE;
@@ -86,7 +86,7 @@ static bool py_apply_type(
{
PYW_GIL_CHECK_LOCKED_SCOPE();
bool rc;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
struc_t *sptr;
member_t *mptr = get_member_by_id(ea, &sptr);
if ( type == nullptr || type[0] == '\0' )
@@ -116,7 +116,7 @@ static bool py_apply_type(
rc = apply_tinfo(ea, tif, flags);
}
}
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return rc;
}
@@ -167,7 +167,7 @@ PyObject *py_unpack_object_from_idb(
PYW_GIL_CHECK_LOCKED_SCOPE();
idc_value_t idc_obj;
error_t err;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
tif.deserialize(ti, &type, &fields);
err = unpack_idcobj_from_idb(
@@ -176,7 +176,7 @@ PyObject *py_unpack_object_from_idb(
ea,
nullptr,
pio_flags);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
// Unpacking failed?
if ( err != eOk )
@@ -221,7 +221,7 @@ PyObject *py_unpack_object_from_bv(
{
idc_value_t idc_obj;
error_t err;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
tif.deserialize(ti, &type, &fields);
err = unpack_idcobj_from_bv(
@@ -229,7 +229,7 @@ PyObject *py_unpack_object_from_bv(
tif,
bytes,
pio_flags);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
// Unpacking failed?
if ( err != eOk )
@@ -282,11 +282,11 @@ PyObject *py_pack_object_to_idb(
// Pack
// error_t err;
error_t err;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
tif.deserialize(ti, &type, &fields);
err = pack_idcobj_to_idb(&idc_obj, tif, ea, pio_flags);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
return PyInt_FromLong(err);
}
@@ -328,7 +328,7 @@ PyObject *py_pack_object_to_bv(
// Pack
relobj_t bytes;
error_t err;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
tif.deserialize(ti, &type, &fields);
err = pack_idcobj_to_bv(
@@ -339,7 +339,7 @@ PyObject *py_pack_object_to_bv(
pio_flags);
if ( err == eOk && !bytes.relocate(base_ea, inf_is_be()) )
err = -1;
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( err == eOk )
return Py_BuildValue("(i" PY_BV_BYTES "#)", 1, bytes.begin(), (Py_ssize_t) bytes.size());
else
@@ -449,24 +449,18 @@ int idc_set_local_type(int ordinal, const char *dcl, int flags)
}
//-------------------------------------------------------------------------
int idc_get_local_type(int ordinal, int flags, char *buf, size_t maxsize)
int idc_get_local_type(int ordinal, int flags, char *buf, size_t bufsize)
{
tinfo_t tif;
if ( !tif.get_numbered_type(nullptr, ordinal) )
{
buf[0] = 0;
return false;
}
qstring res;
const char *name = get_numbered_type_name(nullptr, ordinal);
if ( !tif.print(&res, name, flags, 2, 40) )
{
buf[0] = 0;
return false;
}
qstrncpy(buf, res.begin(), maxsize);
qstrncpy(buf, res.begin(), bufsize);
return true;
}
@@ -480,13 +474,13 @@ PyObject *idc_print_type(
PYW_GIL_CHECK_LOCKED_SCOPE();
qstring res;
bool ok;
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
tinfo_t tif;
ok = tif.deserialize(nullptr, &type, &fields, nullptr)
&& tif.print(&res, name, flags, 2, 40);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
if ( ok )
return IDAPyStr_FromUTF8(res.begin());
return PyUnicode_FromString(res.begin());
else
Py_RETURN_NONE;
}
@@ -546,10 +540,10 @@ PyObject *py_get_named_type(const til_t *til, const char *name, int ntf_flags)
} while ( false )
ADD(PyInt_FromLong(long(code)));
ADD(IDAPyBytes_FromMem((const char *) type));
ADD_OR_NONE(fields != nullptr, IDAPyBytes_FromMem((const char *) fields));
ADD_OR_NONE(cmt != nullptr, IDAPyStr_FromUTF8(cmt));
ADD_OR_NONE(field_cmts != nullptr, IDAPyStr_FromUTF8((const char *) field_cmts));
ADD(PyBytes_FromString((const char *) type));
ADD_OR_NONE(fields != nullptr, PyBytes_FromString((const char *) fields));
ADD_OR_NONE(cmt != nullptr, PyUnicode_FromString(cmt));
ADD_OR_NONE(field_cmts != nullptr, PyUnicode_FromString((const char *) field_cmts));
ADD(PyInt_FromLong(long(sclass)));
if ( (ntf_flags & NTF_64BIT) != 0 )
ADD(PyLong_FromUnsignedLongLong(value));
@@ -581,17 +575,17 @@ PyObject *py_print_decls(text_sink_t &printer, til_t *til, PyObject *py_ordinals
for ( Py_ssize_t i = 0; i < nords; ++i )
{
borref_t item(PyList_GetItem(py_ordinals, i));
if ( item == nullptr || !IDAPyIntOrLong_Check(item.o) )
if ( item == nullptr || !PyLong_Check(item.o) )
{
qstring msg;
msg.sprnt("ordinals[%d] is not a valid value", int(i));
PyErr_SetString(PyExc_ValueError, msg.begin());
return nullptr;
}
uint32 ord = IDAPyIntOrLong_AsLong(item.o);
uint32 ord = PyLong_AsLong(item.o);
ordinals.push_back(ord);
}
return IDAPyInt_FromLong(print_decls(printer, til, ordinals.empty() ? nullptr : &ordinals, flags));
return PyLong_FromLong(print_decls(printer, til, ordinals.empty() ? nullptr : &ordinals, flags));
}
//-------------------------------------------------------------------------
@@ -637,7 +631,7 @@ static PyObject *py_tinfo_t_serialize(
if ( (Thing).empty() ) \
Py_INCREF(Py_None); \
else \
o = IDAPyBytes_FromMem((const char *) (Thing).begin()); \
o = PyBytes_FromString((const char *) (Thing).begin()); \
PyTuple_SetItem(tuple, ctr, o); \
++ctr; \
} while ( false )
+285 -91
View File
@@ -1922,6 +1922,15 @@
'chooser_item_attrs_t_flags_get',
'chooser_item_attrs_t_flags_set',
'chooser_item_attrs_t_reset',
'chooser_stdact_desc_t_icon_get',
'chooser_stdact_desc_t_icon_set',
'chooser_stdact_desc_t_label_get',
'chooser_stdact_desc_t_label_set',
'chooser_stdact_desc_t_tooltip_get',
'chooser_stdact_desc_t_tooltip_set',
'chooser_stdact_desc_t_ucb',
'chooser_stdact_desc_t_version_get',
'chooser_stdact_desc_t_version_set',
'chunk_size',
'chunk_start',
'cif_t___eq__',
@@ -2129,7 +2138,6 @@
'clr_lzero',
'clr_lzero0',
'clr_lzero1',
'clr_module_data',
'clr_node_info',
'clr_noret',
'clr_notcode',
@@ -2292,12 +2300,15 @@
'create_memory_linput',
'create_menu',
'create_mutable_graph',
'create_nodeval_merge_handler',
'create_nodeval_merge_handlers',
'create_numbered_type_name',
'create_outctx',
'create_oword',
'create_packed_real',
'create_qword',
'create_source_viewer',
'create_std_modmerge_handlers',
'create_strlit',
'create_struct',
'create_switch_table',
@@ -2693,6 +2704,7 @@
'delete_channel_redir_t',
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_chooser_stdact_desc_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
@@ -2793,6 +2805,8 @@
'delete_history_t',
'delete_ida_lowertype_helper_t',
'delete_idaplace_t',
'delete_idbattr_info_t',
'delete_idbattr_valmap_t',
'delete_idc_global_t',
'delete_idc_value_t',
'delete_idc_values_t',
@@ -2805,10 +2819,12 @@
'delete_input_event_t',
'delete_insn_t',
'delete_instant_dbgopts_t',
'delete_int64vec_t',
'delete_int_pointer',
'delete_interval_t',
'delete_intvec_t',
'delete_ioports_fallback_t',
'delete_item_block_locator_t',
'delete_iterator',
'delete_ivl_t',
'delete_ivl_with_name_t',
@@ -2824,7 +2840,6 @@
'delete_lochist_t',
'delete_lock_func',
'delete_lock_segment',
'delete_longlongvec_t',
'delete_lowertype_helper_t',
'delete_lvar_locator_t',
'delete_lvar_mapping_iterator_t',
@@ -2850,12 +2865,16 @@
'delete_memreg_info_t',
'delete_memreg_infos_t',
'delete_menu',
'delete_merge_handler_params_t',
'delete_merge_node_helper_t',
'delete_merge_node_info_t',
'delete_microcode_filter_t',
'delete_minsn_t',
'delete_minsn_visitor_t',
'delete_mlist_mop_visitor_t',
'delete_mlist_t',
'delete_mnumber_t',
'delete_moddata_diff_helper_t',
'delete_modinfo_t',
'delete_mop_addr_t',
'delete_mop_pair_t',
@@ -2871,6 +2890,7 @@
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_octet_generator_t',
'delete_op_parent_info_t',
'delete_op_t',
'delete_operand_locator_t',
@@ -2934,6 +2954,7 @@
'delete_segm_move_info_t',
'delete_segm_move_info_vec_t',
'delete_segm_move_infos_t',
'delete_segment_defsr_array',
'delete_segment_t',
'delete_seh_t',
'delete_sel_array',
@@ -3000,8 +3021,8 @@
'delete_ui_stroff_applicator_t',
'delete_ui_stroff_op_t',
'delete_ui_stroff_ops_t',
'delete_uint64vec_t',
'delete_uintvec_t',
'delete_ulonglongvec_t',
'delete_unreferenced_stkvars',
'delete_user_cmts_iterator_t',
'delete_user_cmts_t',
@@ -3043,6 +3064,7 @@
'deref_idcv',
'deref_ptr',
'deserialize_tinfo',
'destroy_moddata_merge_handlers',
'detach_action_from_menu',
'detach_action_from_popup',
'detach_action_from_toolbar',
@@ -3268,6 +3290,7 @@
'disown_cfunc_parentee_t',
'disown_chain_visitor_t',
'disown_choose_ioport_parser_t',
'disown_chooser_stdact_desc_t',
'disown_const_aloc_visitor_t',
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
@@ -3281,10 +3304,13 @@
'disown_graph_visitor_t',
'disown_highlighter_cbs_t',
'disown_ioports_fallback_t',
'disown_item_block_locator_t',
'disown_macro_constructor_t',
'disown_merge_node_helper_t',
'disown_microcode_filter_t',
'disown_minsn_visitor_t',
'disown_mlist_mop_visitor_t',
'disown_moddata_diff_helper_t',
'disown_mop_visitor_t',
'disown_optblock_t',
'disown_optinsn_t',
@@ -3652,6 +3678,7 @@
'find_data',
'find_defined',
'find_error',
'find_free_chunk',
'find_free_selector',
'find_func_bounds',
'find_idc_class',
@@ -4133,6 +4160,7 @@
'get_dtype_flag',
'get_dtype_size',
'get_dword',
'get_ea_diffpos_name',
'get_ea_name',
'get_ea_viewer_history_info',
'get_effective_spd',
@@ -4320,7 +4348,6 @@
'get_member_type',
'get_merror_desc',
'get_min_spd_ea',
'get_module_data',
'get_module_info',
'get_mreg_name',
'get_name',
@@ -4360,6 +4387,7 @@
'get_numbered_type',
'get_numbered_type_name',
'get_octet',
'get_octet2',
'get_offbase',
'get_offset_expr',
'get_offset_expression',
@@ -4834,6 +4862,56 @@
'idainfo_xrefnum_set',
'idaplace_t_ea_get',
'idaplace_t_ea_set',
'idbattr_info_t___lt__',
'idbattr_info_t_bitmask_get',
'idbattr_info_t_bitmask_set',
'idbattr_info_t_has_individual_node',
'idbattr_info_t_hashname',
'idbattr_info_t_idi_flags_get',
'idbattr_info_t_idi_flags_set',
'idbattr_info_t_individual_node_get',
'idbattr_info_t_individual_node_set',
'idbattr_info_t_is_bitfield',
'idbattr_info_t_is_bitmap',
'idbattr_info_t_is_boolean',
'idbattr_info_t_is_buf_var',
'idbattr_info_t_is_bytearray',
'idbattr_info_t_is_cstr',
'idbattr_info_t_is_decimal',
'idbattr_info_t_is_hash',
'idbattr_info_t_is_hexadecimal',
'idbattr_info_t_is_incremented',
'idbattr_info_t_is_node_altval',
'idbattr_info_t_is_node_blob',
'idbattr_info_t_is_node_supval',
'idbattr_info_t_is_node_valobj',
'idbattr_info_t_is_node_var',
'idbattr_info_t_is_onoff',
'idbattr_info_t_is_qstring',
'idbattr_info_t_is_readonly_var',
'idbattr_info_t_is_scalar_var',
'idbattr_info_t_is_struc_field',
'idbattr_info_t_is_val_mapped',
'idbattr_info_t_maxsize_get',
'idbattr_info_t_maxsize_set',
'idbattr_info_t_name_get',
'idbattr_info_t_name_set',
'idbattr_info_t_offset_get',
'idbattr_info_t_offset_set',
'idbattr_info_t_ridx',
'idbattr_info_t_str_false',
'idbattr_info_t_str_true',
'idbattr_info_t_tag_get',
'idbattr_info_t_tag_set',
'idbattr_info_t_use_hlpstruc',
'idbattr_info_t_vmap_get',
'idbattr_info_t_vmap_set',
'idbattr_info_t_width_get',
'idbattr_info_t_width_set',
'idbattr_valmap_t_valname_get',
'idbattr_valmap_t_valname_set',
'idbattr_valmap_t_value_get',
'idbattr_valmap_t_value_set',
'idc_get_local_type',
'idc_get_local_type_name',
'idc_get_local_type_raw',
@@ -5406,6 +5484,45 @@
'instant_dbgopts_t_pid_set',
'instant_dbgopts_t_port_get',
'instant_dbgopts_t_port_set',
'int64vec_t___eq__',
'int64vec_t___getitem__',
'int64vec_t___len__',
'int64vec_t___ne__',
'int64vec_t___setitem__',
'int64vec_t__del',
'int64vec_t_add_unique',
'int64vec_t_at',
'int64vec_t_begin',
'int64vec_t_begin__SWIG_0',
'int64vec_t_begin__SWIG_1',
'int64vec_t_capacity',
'int64vec_t_clear',
'int64vec_t_empty',
'int64vec_t_end',
'int64vec_t_end__SWIG_0',
'int64vec_t_end__SWIG_1',
'int64vec_t_erase',
'int64vec_t_erase__SWIG_0',
'int64vec_t_erase__SWIG_1',
'int64vec_t_extract',
'int64vec_t_find',
'int64vec_t_find__SWIG_0',
'int64vec_t_find__SWIG_1',
'int64vec_t_has',
'int64vec_t_inject',
'int64vec_t_insert',
'int64vec_t_pop_back',
'int64vec_t_push_back',
'int64vec_t_push_back__SWIG_0',
'int64vec_t_push_back__SWIG_1',
'int64vec_t_qclear',
'int64vec_t_reserve',
'int64vec_t_resize',
'int64vec_t_resize__SWIG_0',
'int64vec_t_resize__SWIG_1',
'int64vec_t_size',
'int64vec_t_swap',
'int64vec_t_truncate',
'int_pointer_assign',
'int_pointer_cast',
'int_pointer_frompointer',
@@ -5547,6 +5664,7 @@
'is_defarg',
'is_defarg0',
'is_defarg1',
'is_diff_merge_mode',
'is_double',
'is_dummy_member_name',
'is_dword',
@@ -5748,6 +5866,7 @@
'is_usersp',
'is_userti',
'is_valid_cp',
'is_valid_dstate',
'is_valid_trace_file',
'is_valid_typename',
'is_vararg_cc',
@@ -5763,6 +5882,8 @@
'is_yword',
'is_zstroff',
'is_zword',
'item_block_locator_t_get_block_head',
'item_block_locator_t_setup_blocks',
'iterator___eq__',
'iterator___ne__',
'iterator___ref__',
@@ -5975,45 +6096,6 @@
'lock_segm',
'log2ceil',
'log2floor',
'longlongvec_t___eq__',
'longlongvec_t___getitem__',
'longlongvec_t___len__',
'longlongvec_t___ne__',
'longlongvec_t___setitem__',
'longlongvec_t__del',
'longlongvec_t_add_unique',
'longlongvec_t_at',
'longlongvec_t_begin',
'longlongvec_t_begin__SWIG_0',
'longlongvec_t_begin__SWIG_1',
'longlongvec_t_capacity',
'longlongvec_t_clear',
'longlongvec_t_empty',
'longlongvec_t_end',
'longlongvec_t_end__SWIG_0',
'longlongvec_t_end__SWIG_1',
'longlongvec_t_erase',
'longlongvec_t_erase__SWIG_0',
'longlongvec_t_erase__SWIG_1',
'longlongvec_t_extract',
'longlongvec_t_find',
'longlongvec_t_find__SWIG_0',
'longlongvec_t_find__SWIG_1',
'longlongvec_t_has',
'longlongvec_t_inject',
'longlongvec_t_insert',
'longlongvec_t_pop_back',
'longlongvec_t_push_back',
'longlongvec_t_push_back__SWIG_0',
'longlongvec_t_push_back__SWIG_1',
'longlongvec_t_qclear',
'longlongvec_t_reserve',
'longlongvec_t_resize',
'longlongvec_t_resize__SWIG_0',
'longlongvec_t_resize__SWIG_1',
'longlongvec_t_size',
'longlongvec_t_swap',
'longlongvec_t_truncate',
'lookup_key_code',
'lower_type',
'lowertype_helper_t_func_has_stkframe_hole',
@@ -6159,6 +6241,7 @@
'lvar_t_clr_noptr_var',
'lvar_t_clr_notarg',
'lvar_t_clr_overlapped_var',
'lvar_t_clr_shared',
'lvar_t_clr_spoiled_var',
'lvar_t_clr_thisarg',
'lvar_t_clr_unknown_width',
@@ -6193,6 +6276,7 @@
'lvar_t_is_notarg',
'lvar_t_is_overlapped_var',
'lvar_t_is_result_var',
'lvar_t_is_shared',
'lvar_t_is_spoiled_var',
'lvar_t_is_thisarg',
'lvar_t_is_unknown_width',
@@ -6215,6 +6299,7 @@
'lvar_t_set_noptr_var',
'lvar_t_set_notarg',
'lvar_t_set_overlapped_var',
'lvar_t_set_shared',
'lvar_t_set_spoiled_var',
'lvar_t_set_thisarg',
'lvar_t_set_typed',
@@ -6383,6 +6468,7 @@
'mba_t_gotoff_stkvars_set',
'mba_t_graph_insns',
'mba_t_has_bad_sp',
'mba_t_has_outlines',
'mba_t_has_over_chains',
'mba_t_has_passregs',
'mba_t_has_stack_retval',
@@ -6811,6 +6897,78 @@
'memreg_infos_t_size',
'memreg_infos_t_swap',
'memreg_infos_t_truncate',
'merge_data_t_add_event_handler',
'merge_data_t_base_id',
'merge_data_t_compare_merging_tifs',
'merge_data_t_dbctx_ids_get',
'merge_data_t_dbctx_ids_set',
'merge_data_t_ev_handlers_get',
'merge_data_t_ev_handlers_set',
'merge_data_t_get_block_head',
'merge_data_t_has_existing_node',
'merge_data_t_item_block_locator_get',
'merge_data_t_item_block_locator_set',
'merge_data_t_last_udt_related_merger_get',
'merge_data_t_last_udt_related_merger_set',
'merge_data_t_local_id',
'merge_data_t_map_privrange_id',
'merge_data_t_map_tinfo',
'merge_data_t_nbases_get',
'merge_data_t_nbases_set',
'merge_data_t_remote_id',
'merge_data_t_remove_event_handler',
'merge_data_t_set_dbctx_ids',
'merge_data_t_setup_blocks',
'merge_handler_params_t_insert_after_get',
'merge_handler_params_t_insert_after_set',
'merge_handler_params_t_kind_get',
'merge_handler_params_t_kind_set',
'merge_handler_params_t_label_get',
'merge_handler_params_t_label_set',
'merge_handler_params_t_md_get',
'merge_handler_params_t_mh_flags_get',
'merge_handler_params_t_mh_flags_set',
'merge_handler_params_t_ui_complex_details',
'merge_handler_params_t_ui_complex_details__SWIG_0',
'merge_handler_params_t_ui_complex_details__SWIG_1',
'merge_handler_params_t_ui_complex_name',
'merge_handler_params_t_ui_complex_name__SWIG_0',
'merge_handler_params_t_ui_complex_name__SWIG_1',
'merge_handler_params_t_ui_dp_shortname',
'merge_handler_params_t_ui_dp_shortname__SWIG_0',
'merge_handler_params_t_ui_dp_shortname__SWIG_1',
'merge_handler_params_t_ui_has_details',
'merge_handler_params_t_ui_has_details__SWIG_0',
'merge_handler_params_t_ui_has_details__SWIG_1',
'merge_handler_params_t_ui_indent',
'merge_handler_params_t_ui_indent__SWIG_0',
'merge_handler_params_t_ui_indent__SWIG_1',
'merge_handler_params_t_ui_linediff',
'merge_handler_params_t_ui_linediff__SWIG_0',
'merge_handler_params_t_ui_linediff__SWIG_1',
'merge_handler_params_t_ui_split_char',
'merge_handler_params_t_ui_split_char__SWIG_0',
'merge_handler_params_t_ui_split_char__SWIG_1',
'merge_handler_params_t_ui_split_str',
'merge_handler_params_t_ui_split_str__SWIG_0',
'merge_handler_params_t_ui_split_str__SWIG_1',
'merge_node_helper_t_append_eavec',
'merge_node_helper_t_get_column_headers',
'merge_node_helper_t_get_netnode',
'merge_node_helper_t_is_mergeable',
'merge_node_helper_t_map_scalar',
'merge_node_helper_t_map_string',
'merge_node_helper_t_print_entry_details',
'merge_node_helper_t_print_entry_name',
'merge_node_helper_t_refresh',
'merge_node_info_t_name_get',
'merge_node_info_t_name_set',
'merge_node_info_t_nds_flags_get',
'merge_node_info_t_nds_flags_set',
'merge_node_info_t_node_helper_get',
'merge_node_info_t_node_helper_set',
'merge_node_info_t_tag_get',
'merge_node_info_t_tag_set',
'microcode_filter_t_apply',
'microcode_filter_t_match',
'minsn_t___dbg_get_meminfo',
@@ -6883,7 +7041,7 @@
'minsn_t_l_set',
'minsn_t_lexcompare',
'minsn_t_may_use_aliased_memory',
'minsn_t_modifes_d',
'minsn_t_modifies_d',
'minsn_t_modifies_pair_mop',
'minsn_t_next_get',
'minsn_t_next_set',
@@ -6972,6 +7130,17 @@
'mnumber_t_update_value',
'mnumber_t_value_get',
'mnumber_t_value_set',
'moddata_diff_helper_t_fields_get',
'moddata_diff_helper_t_fields_set',
'moddata_diff_helper_t_get_struc_ptr',
'moddata_diff_helper_t_merge_ending',
'moddata_diff_helper_t_merge_starting',
'moddata_diff_helper_t_module_name_get',
'moddata_diff_helper_t_module_name_set',
'moddata_diff_helper_t_netnode_name_get',
'moddata_diff_helper_t_netnode_name_set',
'moddata_diff_helper_t_nfields_get',
'moddata_diff_helper_t_nfields_set',
'modify_user_lvar_info',
'modify_user_lvars',
'modinfo_t_base_get',
@@ -7510,6 +7679,7 @@
'new_channel_redir_t',
'new_choose_ioport_parser_t',
'new_chooser_item_attrs_t',
'new_chooser_stdact_desc_t',
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
@@ -7599,7 +7769,6 @@
'new_edge_layout_point_t',
'new_edge_layout_point_t__SWIG_0',
'new_edge_layout_point_t__SWIG_1',
'new_edge_layout_point_t__SWIG_2',
'new_edge_segment_t',
'new_edge_t',
'new_edge_t__SWIG_0',
@@ -7668,6 +7837,8 @@
'new_history_item_t__SWIG_1',
'new_history_t',
'new_ida_lowertype_helper_t',
'new_idbattr_info_t',
'new_idbattr_valmap_t',
'new_idc_global_t',
'new_idc_global_t__SWIG_0',
'new_idc_global_t__SWIG_1',
@@ -7686,6 +7857,9 @@
'new_input_event_t',
'new_insn_t',
'new_instant_dbgopts_t',
'new_int64vec_t',
'new_int64vec_t__SWIG_0',
'new_int64vec_t__SWIG_1',
'new_int_pointer',
'new_interval_t',
'new_interval_t__SWIG_0',
@@ -7695,6 +7869,7 @@
'new_intvec_t__SWIG_0',
'new_intvec_t__SWIG_1',
'new_ioports_fallback_t',
'new_item_block_locator_t',
'new_iterator',
'new_ivl_t',
'new_ivl_with_name_t',
@@ -7719,9 +7894,6 @@
'new_lochist_t',
'new_lock_func',
'new_lock_segment',
'new_longlongvec_t',
'new_longlongvec_t__SWIG_0',
'new_longlongvec_t__SWIG_1',
'new_lvar_locator_t',
'new_lvar_locator_t__SWIG_0',
'new_lvar_locator_t__SWIG_1',
@@ -7758,6 +7930,9 @@
'new_memreg_infos_t',
'new_memreg_infos_t__SWIG_0',
'new_memreg_infos_t__SWIG_1',
'new_merge_handler_params_t',
'new_merge_node_helper_t',
'new_merge_node_info_t',
'new_microcode_filter_t',
'new_minsn_t',
'new_minsn_t__SWIG_0',
@@ -7769,6 +7944,7 @@
'new_mlist_t__SWIG_1',
'new_mlist_t__SWIG_2',
'new_mnumber_t',
'new_moddata_diff_helper_t',
'new_modinfo_t',
'new_mop_addr_t',
'new_mop_addr_t__SWIG_0',
@@ -7794,6 +7970,7 @@
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_octet_generator_t',
'new_op_parent_info_t',
'new_op_t',
'new_operand_locator_t',
@@ -7911,6 +8088,7 @@
'new_segm_move_info_vec_t__SWIG_0',
'new_segm_move_info_vec_t__SWIG_1',
'new_segm_move_infos_t',
'new_segment_defsr_array',
'new_segment_t',
'new_seh_t',
'new_sel_array',
@@ -8014,12 +8192,12 @@
'new_ui_stroff_ops_t',
'new_ui_stroff_ops_t__SWIG_0',
'new_ui_stroff_ops_t__SWIG_1',
'new_uint64vec_t',
'new_uint64vec_t__SWIG_0',
'new_uint64vec_t__SWIG_1',
'new_uintvec_t',
'new_uintvec_t__SWIG_0',
'new_uintvec_t__SWIG_1',
'new_ulonglongvec_t',
'new_ulonglongvec_t__SWIG_0',
'new_ulonglongvec_t__SWIG_1',
'new_user_cmts_iterator_t',
'new_user_cmts_t',
'new_user_defined_prefix_t',
@@ -8179,6 +8357,15 @@
'number_format_t_type_name_get',
'number_format_t_type_name_set',
'oct_flag',
'octet_generator_t_avail_bits_get',
'octet_generator_t_avail_bits_set',
'octet_generator_t_ea_get',
'octet_generator_t_ea_set',
'octet_generator_t_high_byte_first_get',
'octet_generator_t_high_byte_first_set',
'octet_generator_t_invert_byte_order',
'octet_generator_t_value_get',
'octet_generator_t_value_set',
'off_flag',
'op_adds_xrefs',
'op_bin',
@@ -9700,6 +9887,13 @@
'segm_move_info_vec_t_swap',
'segm_move_info_vec_t_truncate',
'segm_move_infos_t_find',
'segment_defsr_array___getitem__',
'segment_defsr_array___len__',
'segment_defsr_array___setitem__',
'segment_defsr_array__get_bytes',
'segment_defsr_array__set_bytes',
'segment_defsr_array_data_get',
'segment_t___getDefsr',
'segment_t_abits',
'segment_t_abytes',
'segment_t_align_get',
@@ -9886,7 +10080,6 @@
'set_member_name',
'set_member_tinfo',
'set_member_type',
'set_module_data',
'set_name',
'set_nav_colorizer',
'set_node_info',
@@ -9910,6 +10103,7 @@
'set_reg_val',
'set_reg_val__SWIG_0',
'set_reg_val__SWIG_1',
'set_registry_root',
'set_regvar_cmt',
'set_remote_debugger',
'set_resume_mode',
@@ -11041,6 +11235,45 @@
'ui_stroff_ops_t_size',
'ui_stroff_ops_t_swap',
'ui_stroff_ops_t_truncate',
'uint64vec_t___eq__',
'uint64vec_t___getitem__',
'uint64vec_t___len__',
'uint64vec_t___ne__',
'uint64vec_t___setitem__',
'uint64vec_t__del',
'uint64vec_t_add_unique',
'uint64vec_t_at',
'uint64vec_t_begin',
'uint64vec_t_begin__SWIG_0',
'uint64vec_t_begin__SWIG_1',
'uint64vec_t_capacity',
'uint64vec_t_clear',
'uint64vec_t_empty',
'uint64vec_t_end',
'uint64vec_t_end__SWIG_0',
'uint64vec_t_end__SWIG_1',
'uint64vec_t_erase',
'uint64vec_t_erase__SWIG_0',
'uint64vec_t_erase__SWIG_1',
'uint64vec_t_extract',
'uint64vec_t_find',
'uint64vec_t_find__SWIG_0',
'uint64vec_t_find__SWIG_1',
'uint64vec_t_has',
'uint64vec_t_inject',
'uint64vec_t_insert',
'uint64vec_t_pop_back',
'uint64vec_t_push_back',
'uint64vec_t_push_back__SWIG_0',
'uint64vec_t_push_back__SWIG_1',
'uint64vec_t_qclear',
'uint64vec_t_reserve',
'uint64vec_t_resize',
'uint64vec_t_resize__SWIG_0',
'uint64vec_t_resize__SWIG_1',
'uint64vec_t_size',
'uint64vec_t_swap',
'uint64vec_t_truncate',
'uintvec_t___eq__',
'uintvec_t___getitem__',
'uintvec_t___len__',
@@ -11080,45 +11313,6 @@
'uintvec_t_size',
'uintvec_t_swap',
'uintvec_t_truncate',
'ulonglongvec_t___eq__',
'ulonglongvec_t___getitem__',
'ulonglongvec_t___len__',
'ulonglongvec_t___ne__',
'ulonglongvec_t___setitem__',
'ulonglongvec_t__del',
'ulonglongvec_t_add_unique',
'ulonglongvec_t_at',
'ulonglongvec_t_begin',
'ulonglongvec_t_begin__SWIG_0',
'ulonglongvec_t_begin__SWIG_1',
'ulonglongvec_t_capacity',
'ulonglongvec_t_clear',
'ulonglongvec_t_empty',
'ulonglongvec_t_end',
'ulonglongvec_t_end__SWIG_0',
'ulonglongvec_t_end__SWIG_1',
'ulonglongvec_t_erase',
'ulonglongvec_t_erase__SWIG_0',
'ulonglongvec_t_erase__SWIG_1',
'ulonglongvec_t_extract',
'ulonglongvec_t_find',
'ulonglongvec_t_find__SWIG_0',
'ulonglongvec_t_find__SWIG_1',
'ulonglongvec_t_has',
'ulonglongvec_t_inject',
'ulonglongvec_t_insert',
'ulonglongvec_t_pop_back',
'ulonglongvec_t_push_back',
'ulonglongvec_t_push_back__SWIG_0',
'ulonglongvec_t_push_back__SWIG_1',
'ulonglongvec_t_qclear',
'ulonglongvec_t_reserve',
'ulonglongvec_t_resize',
'ulonglongvec_t_resize__SWIG_0',
'ulonglongvec_t_resize__SWIG_1',
'ulonglongvec_t_size',
'ulonglongvec_t_swap',
'ulonglongvec_t_truncate',
'unhide_border',
'unhide_item',
'unmark_selection',
@@ -1922,6 +1922,15 @@
'chooser_item_attrs_t_flags_get',
'chooser_item_attrs_t_flags_set',
'chooser_item_attrs_t_reset',
'chooser_stdact_desc_t_icon_get',
'chooser_stdact_desc_t_icon_set',
'chooser_stdact_desc_t_label_get',
'chooser_stdact_desc_t_label_set',
'chooser_stdact_desc_t_tooltip_get',
'chooser_stdact_desc_t_tooltip_set',
'chooser_stdact_desc_t_ucb',
'chooser_stdact_desc_t_version_get',
'chooser_stdact_desc_t_version_set',
'chunk_size',
'chunk_start',
'cif_t___eq__',
@@ -2129,7 +2138,6 @@
'clr_lzero',
'clr_lzero0',
'clr_lzero1',
'clr_module_data',
'clr_node_info',
'clr_noret',
'clr_notcode',
@@ -2693,6 +2701,7 @@
'delete_channel_redir_t',
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_chooser_stdact_desc_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
@@ -2805,6 +2814,7 @@
'delete_input_event_t',
'delete_insn_t',
'delete_instant_dbgopts_t',
'delete_int64vec_t',
'delete_int_pointer',
'delete_interval_t',
'delete_intvec_t',
@@ -2824,7 +2834,6 @@
'delete_lochist_t',
'delete_lock_func',
'delete_lock_segment',
'delete_longlongvec_t',
'delete_lowertype_helper_t',
'delete_lvar_locator_t',
'delete_lvar_mapping_iterator_t',
@@ -2871,6 +2880,7 @@
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_octet_generator_t',
'delete_op_parent_info_t',
'delete_op_t',
'delete_operand_locator_t',
@@ -2934,6 +2944,7 @@
'delete_segm_move_info_t',
'delete_segm_move_info_vec_t',
'delete_segm_move_infos_t',
'delete_segment_defsr_array',
'delete_segment_t',
'delete_seh_t',
'delete_sel_array',
@@ -3000,8 +3011,8 @@
'delete_ui_stroff_applicator_t',
'delete_ui_stroff_op_t',
'delete_ui_stroff_ops_t',
'delete_uint64vec_t',
'delete_uintvec_t',
'delete_ulonglongvec_t',
'delete_unreferenced_stkvars',
'delete_user_cmts_iterator_t',
'delete_user_cmts_t',
@@ -3268,6 +3279,7 @@
'disown_cfunc_parentee_t',
'disown_chain_visitor_t',
'disown_choose_ioport_parser_t',
'disown_chooser_stdact_desc_t',
'disown_const_aloc_visitor_t',
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
@@ -3652,6 +3664,7 @@
'find_data',
'find_defined',
'find_error',
'find_free_chunk',
'find_free_selector',
'find_func_bounds',
'find_idc_class',
@@ -4320,7 +4333,6 @@
'get_member_type',
'get_merror_desc',
'get_min_spd_ea',
'get_module_data',
'get_module_info',
'get_mreg_name',
'get_name',
@@ -4360,6 +4372,7 @@
'get_numbered_type',
'get_numbered_type_name',
'get_octet',
'get_octet2',
'get_offbase',
'get_offset_expr',
'get_offset_expression',
@@ -5406,6 +5419,45 @@
'instant_dbgopts_t_pid_set',
'instant_dbgopts_t_port_get',
'instant_dbgopts_t_port_set',
'int64vec_t___eq__',
'int64vec_t___getitem__',
'int64vec_t___len__',
'int64vec_t___ne__',
'int64vec_t___setitem__',
'int64vec_t__del',
'int64vec_t_add_unique',
'int64vec_t_at',
'int64vec_t_begin',
'int64vec_t_begin__SWIG_0',
'int64vec_t_begin__SWIG_1',
'int64vec_t_capacity',
'int64vec_t_clear',
'int64vec_t_empty',
'int64vec_t_end',
'int64vec_t_end__SWIG_0',
'int64vec_t_end__SWIG_1',
'int64vec_t_erase',
'int64vec_t_erase__SWIG_0',
'int64vec_t_erase__SWIG_1',
'int64vec_t_extract',
'int64vec_t_find',
'int64vec_t_find__SWIG_0',
'int64vec_t_find__SWIG_1',
'int64vec_t_has',
'int64vec_t_inject',
'int64vec_t_insert',
'int64vec_t_pop_back',
'int64vec_t_push_back',
'int64vec_t_push_back__SWIG_0',
'int64vec_t_push_back__SWIG_1',
'int64vec_t_qclear',
'int64vec_t_reserve',
'int64vec_t_resize',
'int64vec_t_resize__SWIG_0',
'int64vec_t_resize__SWIG_1',
'int64vec_t_size',
'int64vec_t_swap',
'int64vec_t_truncate',
'int_pointer_assign',
'int_pointer_cast',
'int_pointer_frompointer',
@@ -5748,6 +5800,7 @@
'is_usersp',
'is_userti',
'is_valid_cp',
'is_valid_dstate',
'is_valid_trace_file',
'is_valid_typename',
'is_vararg_cc',
@@ -5923,7 +5976,7 @@
'loader_input_t_from_capsule',
'loader_input_t_from_fp',
'loader_input_t_from_linput',
'loader_input_t_get_char',
'loader_input_t_get_byte',
'loader_input_t_get_linput',
'loader_input_t_gets',
'loader_input_t_getz',
@@ -5975,45 +6028,6 @@
'lock_segm',
'log2ceil',
'log2floor',
'longlongvec_t___eq__',
'longlongvec_t___getitem__',
'longlongvec_t___len__',
'longlongvec_t___ne__',
'longlongvec_t___setitem__',
'longlongvec_t__del',
'longlongvec_t_add_unique',
'longlongvec_t_at',
'longlongvec_t_begin',
'longlongvec_t_begin__SWIG_0',
'longlongvec_t_begin__SWIG_1',
'longlongvec_t_capacity',
'longlongvec_t_clear',
'longlongvec_t_empty',
'longlongvec_t_end',
'longlongvec_t_end__SWIG_0',
'longlongvec_t_end__SWIG_1',
'longlongvec_t_erase',
'longlongvec_t_erase__SWIG_0',
'longlongvec_t_erase__SWIG_1',
'longlongvec_t_extract',
'longlongvec_t_find',
'longlongvec_t_find__SWIG_0',
'longlongvec_t_find__SWIG_1',
'longlongvec_t_has',
'longlongvec_t_inject',
'longlongvec_t_insert',
'longlongvec_t_pop_back',
'longlongvec_t_push_back',
'longlongvec_t_push_back__SWIG_0',
'longlongvec_t_push_back__SWIG_1',
'longlongvec_t_qclear',
'longlongvec_t_reserve',
'longlongvec_t_resize',
'longlongvec_t_resize__SWIG_0',
'longlongvec_t_resize__SWIG_1',
'longlongvec_t_size',
'longlongvec_t_swap',
'longlongvec_t_truncate',
'lookup_key_code',
'lower_type',
'lowertype_helper_t_func_has_stkframe_hole',
@@ -6159,6 +6173,7 @@
'lvar_t_clr_noptr_var',
'lvar_t_clr_notarg',
'lvar_t_clr_overlapped_var',
'lvar_t_clr_shared',
'lvar_t_clr_spoiled_var',
'lvar_t_clr_thisarg',
'lvar_t_clr_unknown_width',
@@ -6193,6 +6208,7 @@
'lvar_t_is_notarg',
'lvar_t_is_overlapped_var',
'lvar_t_is_result_var',
'lvar_t_is_shared',
'lvar_t_is_spoiled_var',
'lvar_t_is_thisarg',
'lvar_t_is_unknown_width',
@@ -6215,6 +6231,7 @@
'lvar_t_set_noptr_var',
'lvar_t_set_notarg',
'lvar_t_set_overlapped_var',
'lvar_t_set_shared',
'lvar_t_set_spoiled_var',
'lvar_t_set_thisarg',
'lvar_t_set_typed',
@@ -6383,6 +6400,7 @@
'mba_t_gotoff_stkvars_set',
'mba_t_graph_insns',
'mba_t_has_bad_sp',
'mba_t_has_outlines',
'mba_t_has_over_chains',
'mba_t_has_passregs',
'mba_t_has_stack_retval',
@@ -6883,7 +6901,7 @@
'minsn_t_l_set',
'minsn_t_lexcompare',
'minsn_t_may_use_aliased_memory',
'minsn_t_modifes_d',
'minsn_t_modifies_d',
'minsn_t_modifies_pair_mop',
'minsn_t_next_get',
'minsn_t_next_set',
@@ -7374,7 +7392,11 @@
'netnode_supprev',
'netnode_supprev_idx8',
'netnode_supset',
'netnode_supset__SWIG_0',
'netnode_supset__SWIG_1',
'netnode_supset_ea',
'netnode_supset_ea__SWIG_0',
'netnode_supset_ea__SWIG_1',
'netnode_supset_idx8',
'netnode_supshift',
'netnode_supstr',
@@ -7506,6 +7528,7 @@
'new_channel_redir_t',
'new_choose_ioport_parser_t',
'new_chooser_item_attrs_t',
'new_chooser_stdact_desc_t',
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
@@ -7595,7 +7618,6 @@
'new_edge_layout_point_t',
'new_edge_layout_point_t__SWIG_0',
'new_edge_layout_point_t__SWIG_1',
'new_edge_layout_point_t__SWIG_2',
'new_edge_segment_t',
'new_edge_t',
'new_edge_t__SWIG_0',
@@ -7682,6 +7704,9 @@
'new_input_event_t',
'new_insn_t',
'new_instant_dbgopts_t',
'new_int64vec_t',
'new_int64vec_t__SWIG_0',
'new_int64vec_t__SWIG_1',
'new_int_pointer',
'new_interval_t',
'new_interval_t__SWIG_0',
@@ -7715,9 +7740,6 @@
'new_lochist_t',
'new_lock_func',
'new_lock_segment',
'new_longlongvec_t',
'new_longlongvec_t__SWIG_0',
'new_longlongvec_t__SWIG_1',
'new_lvar_locator_t',
'new_lvar_locator_t__SWIG_0',
'new_lvar_locator_t__SWIG_1',
@@ -7790,6 +7812,7 @@
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_octet_generator_t',
'new_op_parent_info_t',
'new_op_t',
'new_operand_locator_t',
@@ -7907,6 +7930,7 @@
'new_segm_move_info_vec_t__SWIG_0',
'new_segm_move_info_vec_t__SWIG_1',
'new_segm_move_infos_t',
'new_segment_defsr_array',
'new_segment_t',
'new_seh_t',
'new_sel_array',
@@ -8010,12 +8034,12 @@
'new_ui_stroff_ops_t',
'new_ui_stroff_ops_t__SWIG_0',
'new_ui_stroff_ops_t__SWIG_1',
'new_uint64vec_t',
'new_uint64vec_t__SWIG_0',
'new_uint64vec_t__SWIG_1',
'new_uintvec_t',
'new_uintvec_t__SWIG_0',
'new_uintvec_t__SWIG_1',
'new_ulonglongvec_t',
'new_ulonglongvec_t__SWIG_0',
'new_ulonglongvec_t__SWIG_1',
'new_user_cmts_iterator_t',
'new_user_cmts_t',
'new_user_defined_prefix_t',
@@ -8175,6 +8199,15 @@
'number_format_t_type_name_get',
'number_format_t_type_name_set',
'oct_flag',
'octet_generator_t_avail_bits_get',
'octet_generator_t_avail_bits_set',
'octet_generator_t_ea_get',
'octet_generator_t_ea_set',
'octet_generator_t_high_byte_first_get',
'octet_generator_t_high_byte_first_set',
'octet_generator_t_invert_byte_order',
'octet_generator_t_value_get',
'octet_generator_t_value_set',
'off_flag',
'op_adds_xrefs',
'op_bin',
@@ -8716,12 +8749,12 @@
'qfile_t_flush',
'qfile_t_from_capsule',
'qfile_t_from_fp',
'qfile_t_get_char',
'qfile_t_get_byte',
'qfile_t_get_fp',
'qfile_t_gets',
'qfile_t_open',
'qfile_t_opened',
'qfile_t_put_char',
'qfile_t_put_byte',
'qfile_t_puts',
'qfile_t_read',
'qfile_t_readbytes',
@@ -9696,6 +9729,13 @@
'segm_move_info_vec_t_swap',
'segm_move_info_vec_t_truncate',
'segm_move_infos_t_find',
'segment_defsr_array___getitem__',
'segment_defsr_array___len__',
'segment_defsr_array___setitem__',
'segment_defsr_array__get_bytes',
'segment_defsr_array__set_bytes',
'segment_defsr_array_data_get',
'segment_t___getDefsr',
'segment_t_abits',
'segment_t_abytes',
'segment_t_align_get',
@@ -9882,7 +9922,6 @@
'set_member_name',
'set_member_tinfo',
'set_member_type',
'set_module_data',
'set_name',
'set_nav_colorizer',
'set_node_info',
@@ -9906,6 +9945,7 @@
'set_reg_val',
'set_reg_val__SWIG_0',
'set_reg_val__SWIG_1',
'set_registry_root',
'set_regvar_cmt',
'set_remote_debugger',
'set_resume_mode',
@@ -11037,6 +11077,45 @@
'ui_stroff_ops_t_size',
'ui_stroff_ops_t_swap',
'ui_stroff_ops_t_truncate',
'uint64vec_t___eq__',
'uint64vec_t___getitem__',
'uint64vec_t___len__',
'uint64vec_t___ne__',
'uint64vec_t___setitem__',
'uint64vec_t__del',
'uint64vec_t_add_unique',
'uint64vec_t_at',
'uint64vec_t_begin',
'uint64vec_t_begin__SWIG_0',
'uint64vec_t_begin__SWIG_1',
'uint64vec_t_capacity',
'uint64vec_t_clear',
'uint64vec_t_empty',
'uint64vec_t_end',
'uint64vec_t_end__SWIG_0',
'uint64vec_t_end__SWIG_1',
'uint64vec_t_erase',
'uint64vec_t_erase__SWIG_0',
'uint64vec_t_erase__SWIG_1',
'uint64vec_t_extract',
'uint64vec_t_find',
'uint64vec_t_find__SWIG_0',
'uint64vec_t_find__SWIG_1',
'uint64vec_t_has',
'uint64vec_t_inject',
'uint64vec_t_insert',
'uint64vec_t_pop_back',
'uint64vec_t_push_back',
'uint64vec_t_push_back__SWIG_0',
'uint64vec_t_push_back__SWIG_1',
'uint64vec_t_qclear',
'uint64vec_t_reserve',
'uint64vec_t_resize',
'uint64vec_t_resize__SWIG_0',
'uint64vec_t_resize__SWIG_1',
'uint64vec_t_size',
'uint64vec_t_swap',
'uint64vec_t_truncate',
'uintvec_t___eq__',
'uintvec_t___getitem__',
'uintvec_t___len__',
@@ -11076,45 +11155,6 @@
'uintvec_t_size',
'uintvec_t_swap',
'uintvec_t_truncate',
'ulonglongvec_t___eq__',
'ulonglongvec_t___getitem__',
'ulonglongvec_t___len__',
'ulonglongvec_t___ne__',
'ulonglongvec_t___setitem__',
'ulonglongvec_t__del',
'ulonglongvec_t_add_unique',
'ulonglongvec_t_at',
'ulonglongvec_t_begin',
'ulonglongvec_t_begin__SWIG_0',
'ulonglongvec_t_begin__SWIG_1',
'ulonglongvec_t_capacity',
'ulonglongvec_t_clear',
'ulonglongvec_t_empty',
'ulonglongvec_t_end',
'ulonglongvec_t_end__SWIG_0',
'ulonglongvec_t_end__SWIG_1',
'ulonglongvec_t_erase',
'ulonglongvec_t_erase__SWIG_0',
'ulonglongvec_t_erase__SWIG_1',
'ulonglongvec_t_extract',
'ulonglongvec_t_find',
'ulonglongvec_t_find__SWIG_0',
'ulonglongvec_t_find__SWIG_1',
'ulonglongvec_t_has',
'ulonglongvec_t_inject',
'ulonglongvec_t_insert',
'ulonglongvec_t_pop_back',
'ulonglongvec_t_push_back',
'ulonglongvec_t_push_back__SWIG_0',
'ulonglongvec_t_push_back__SWIG_1',
'ulonglongvec_t_qclear',
'ulonglongvec_t_reserve',
'ulonglongvec_t_resize',
'ulonglongvec_t_resize__SWIG_0',
'ulonglongvec_t_resize__SWIG_1',
'ulonglongvec_t_size',
'ulonglongvec_t_swap',
'ulonglongvec_t_truncate',
'unhide_border',
'unhide_item',
'unmark_selection',
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+10 -7
View File
@@ -39,6 +39,7 @@
%rename (bin_search) py_bin_search;
%rename (bin_search) bin_search2;
%ignore bin_search2(ea_t, ea_t, const uchar *, const uchar *, size_t, int);
%ignore bytes_match_for_bin_search;
%ignore get_8bit;
%rename (get_8bit) py_get_8bit;
@@ -46,6 +47,8 @@
%ignore get_octet;
%rename (get_octet) py_get_octet;
%apply uchar * OUTPUT { uchar *out }; // get_octet2
%template(compiled_binpat_vec_t) qvector<compiled_binpat_t>;
%apply size_t * OUTPUT { size_t *out_matched_idx }; // bin_search3
@@ -54,7 +57,7 @@
%ignore set_dbgmem_source;
%typemap(argout) opinfo_t *buf {
if ( result != NULL )
if ( result != nullptr )
{
// kludge: discard newly-constructed object; return input
Py_XDECREF($result);
@@ -90,9 +93,9 @@
PyObject *self,
const char *name,
asize_t value_size=0,
const char *menu_name=NULL,
const char *hotkey=NULL,
const char *asm_keyword=NULL,
const char *menu_name=nullptr,
const char *hotkey=nullptr,
const char *asm_keyword=nullptr,
int props=0)
{
py_custom_data_type_t *inst = new py_custom_data_type_t(
@@ -128,9 +131,9 @@
PyObject *self,
const char *name,
asize_t value_size=0,
const char *menu_name=NULL,
const char *menu_name=nullptr,
int props=0,
const char *hotkey=NULL,
const char *hotkey=nullptr,
int32 text_width=0)
{
py_custom_data_format_t *inst = new py_custom_data_format_t(
@@ -169,7 +172,7 @@
%apply (const bytevec_t &_fields) { const bytevec_t &imask };
%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) const bytevec_t &imask
{ // %typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) const bytevec_t &imask
$1 = ($input == Py_None || IDAPyBytes_Check($input)) ? 1 : 0;
$1 = ($input == Py_None || PyBytes_Check($input)) ? 1 : 0;
}
//
+9 -9
View File
@@ -72,7 +72,7 @@
%typemap(argout) qstring *ARG_NAME
{
// %get_process_options_out_qstring %typemap(argout) qstring *ARG_NAME
$result = SWIG_Python_AppendOutput($result, IDAPyStr_FromUTF8($1->c_str()));
$result = SWIG_Python_AppendOutput($result, PyUnicode_FromString($1->c_str()));
}
%typemap(freearg) qstring* ARG_NAME
{
@@ -93,7 +93,7 @@
{
// %typemap(argout) qstring *path (specialization)
Py_XDECREF($result);
$result = IDAPyStr_FromUTF8($1->c_str());
$result = PyUnicode_FromString($1->c_str());
}
//-------------------------------------------------------------------------
@@ -130,28 +130,28 @@ bool request_run_to(ea_t ea, pid_t pid = NO_PROCESS, thid_t tid = NO_THREAD);
%{
PyObject *bpt_t_condition_get(bpt_t *bpt)
{
return IDAPyStr_FromUTF8(bpt->cndbody.c_str());
return PyUnicode_FromString(bpt->cndbody.c_str());
}
void bpt_t_condition_set(bpt_t *bpt, PyObject *val)
{
if ( IDAPyStr_Check(val) )
IDAPyStr_AsUTF8(&bpt->cndbody, val);
if ( PyUnicode_Check(val) )
PyUnicode_as_qstring(&bpt->cndbody, val);
else
PyErr_SetString(PyExc_ValueError, "expected a string");
}
PyObject *bpt_t_elang_get(bpt_t *bpt)
{
return IDAPyStr_FromUTF8(bpt->get_cnd_elang());
return PyUnicode_FromString(bpt->get_cnd_elang());
}
void bpt_t_elang_set(bpt_t *bpt, PyObject *val)
{
if ( IDAPyStr_Check(val) )
if ( PyUnicode_Check(val) )
{
qstring cval;
IDAPyStr_AsUTF8(&cval, val);
PyUnicode_as_qstring(&cval, val);
if ( !bpt->set_cnd_elang(cval.c_str()) )
PyErr_SetString(PyExc_ValueError, "too many extlangs");
}
@@ -169,7 +169,7 @@ void bpt_t_elang_set(bpt_t *bpt, PyObject *val)
{
PyObject *get_bytes() const
{
return IDAPyBytes_FromMemAndSize(
return PyBytes_FromStringAndSize(
(const char *) $self->bytes.begin(),
$self->bytes.size());
}
+3 -5
View File
@@ -39,7 +39,7 @@
{
dynamic_wrapped_array_t<stkpnt_t> __get_points__()
{
if ( $self->pntqty > 0 && $self->points == NULL ) // force load
if ( $self->pntqty > 0 && $self->points == nullptr ) // force load
get_sp_delta($self, $self->start_ea);
return dynamic_wrapped_array_t<stkpnt_t>($self->points, $self->pntqty);
}
@@ -47,7 +47,7 @@
dynamic_wrapped_array_t<regvar_t> __get_regvars__()
{
if ( $self->regvarqty < 0 ) // force load
find_regvar($self, $self->start_ea, NULL);
find_regvar($self, $self->start_ea, nullptr);
return dynamic_wrapped_array_t<regvar_t>($self->regvars, $self->regvarqty);
}
@@ -63,7 +63,7 @@
dynamic_wrapped_array_t<regarg_t> __get_regargs__()
{
if ( $self->regargqty > 0 && $self->regargs == NULL ) // force load
if ( $self->regargqty > 0 && $self->regargs == nullptr ) // force load
read_regargs($self);
return dynamic_wrapped_array_t<regarg_t>($self->regargs, $self->regargqty);
}
@@ -118,7 +118,6 @@
%def_simple_func_item_iterator_t_generator(head_items, next_head, item heads contained within the function);
%def_simple_func_item_iterator_t_generator(not_tails, next_not_tail, non-tail addresses contained within the function);
#ifdef PY3
%define %alias_func_item_iterator(PROP_NAME)
%extend func_t
{
@@ -136,7 +135,6 @@
%alias_func_item_iterator(data_items);
%alias_func_item_iterator(head_items);
%alias_func_item_iterator(not_tails);
#endif
%extend func_t
{
+17 -31
View File
@@ -23,25 +23,18 @@ SWIGINTERN void __raise_vdf(const vd_failure_t &e)
// Integrated into IDAPython project by the IDAPython Team <idapython@googlegroups.com>
//---------------------------------------------------------------------
// Suppress 'previous definition of XX' warnings
#pragma SWIG nowarn=302
// and others...
#pragma SWIG nowarn=312
#pragma SWIG nowarn=325
#pragma SWIG nowarn=314
#pragma SWIG nowarn=362
#pragma SWIG nowarn=383
#pragma SWIG nowarn=389
#pragma SWIG nowarn=401
#pragma SWIG nowarn=451
#pragma SWIG nowarn=454 // Setting a pointer/reference variable may leak memory
#define _STD_BEGIN
#ifdef __NT__
%include <windows.i>
#endif
%typemap(check) ctype_t cexpr_op {
// %typemap(check) ctype_t cexpr_op
if ( $1 < cot_empty || $1 > cot_last )
SWIG_exception_fail(SWIG_ValueError, "invalid op " "in method '" "$symname" "', argument " "$argnum"" of type '" "$1_type""'");
}
%typemap(check) const tinfo_t *type {
// %typemap(check) const tinfo_t *type
}
@@ -241,20 +234,13 @@ SWIGINTERN void __raise_vdf(const vd_failure_t &e)
%newobject gen_microcode;
%define_hexrays_lifecycle_object(mba_t);
#ifdef PY3
%const_void_pointer_and_size(uchar, bytes, nbytes);
%const_void_pointer_and_size(void, bytes, _size);
#else
%apply (char *STRING, int LENGTH) { (const uchar *bytes, size_t nbytes) };
%apply Pointer NONNULL { const uchar *bytes };
%apply (char *STRING, int LENGTH) { (const void *bytes, size_t _size) };
%apply Pointer NONNULL { const void *bytes };
#endif
%define_hexrays_lifecycle_object(valrng_t);
%apply ulonglong *OUTPUT { uvlr_t *v }; // valrng_t::cvt_to_single_value
%apply ulonglong *OUTPUT { uvlr_t *val }; // valrng_t::cvt_to_cmp
%apply int *OUTPUT { cmpop_t *cmp }; // valrng_t::cvt_to_cmp
%apply uint64 *OUTPUT { uvlr_t *v }; // valrng_t::cvt_to_single_value
%apply uint64 *OUTPUT { uvlr_t *val }; // valrng_t::cvt_to_cmp
%apply int *OUTPUT { cmpop_t *cmp }; // valrng_t::cvt_to_cmp
%define %def_opt_handler(TypeName, Install, Remove, Hxclr)
%ignore Install;
@@ -326,7 +312,7 @@ SWIGINTERN void __raise_vdf(const vd_failure_t &e)
%fragment("cvt_cfunc_t", "header")
{
bool cvt_cfunc_t(cfunc_t **out, PyObject *obj)
int cvt_cfunc_t(cfunc_t **out, PyObject *obj)
{
cfunc_t *cfunc = 0;
int res = SWIG_ConvertPtr(obj, (void **) &cfunc, SWIGTYPE_p_cfunc_t, 0 | 0);
@@ -496,10 +482,10 @@ public:
const char *_get_##PNAME() const { return $self->PNAME; }
void _set_##PNAME(const char *_v)
{
if ( $self->PNAME != NULL )
if ( $self->PNAME != nullptr )
{
::qfree($self->PNAME);
$self->PNAME = NULL;
$self->PNAME = nullptr;
}
$self->PNAME = ::qstrdup(_v);
}
@@ -734,7 +720,7 @@ cexpr_t *citem_t_cexpr_get(citem_t *item) { return (cexpr_t *) item; }
//-------------------------------------------------------------------------
%define_hexrays_lifecycle_object(cexpr_t);
%extend cexpr_t {
var_ref_t* get_v() { if ( self->op == cot_var ) { return &self->v; } else { return NULL; } }
var_ref_t* get_v() { if ( self->op == cot_var ) { return &self->v; } else { return nullptr; } }
void set_v(const var_ref_t *v) { if ( self->op == cot_var ) { self->v = *v; } }
%pythoncode {
v = property(lambda self: self.get_v(), lambda self, v: self.set_v(v))
@@ -792,7 +778,7 @@ cexpr_t *citem_t_cexpr_get(citem_t *item) { return (cexpr_t *) item; }
// }
//
// #define CTREE_CONDITIONAL_ITEM_MEMBER_REF(type, name, wanted_citype) \
// type get_##name() const { if ( self->citype == wanted_citype ) { return self->##name; } else { return NULL; } } \
// type get_##name() const { if ( self->citype == wanted_citype ) { return self->##name; } else { return nullptr; } } \
// void set_##name(type _v) { if ( self->citype == wanted_citype ) { self->##name = _v; } } \
// %pythoncode { \
// name = property(lambda self: self.get_##name(), lambda self, v: self.set_##name(v)) \
@@ -810,7 +796,7 @@ cexpr_t *citem_t_cexpr_get(citem_t *item) { return (cexpr_t *) item; }
if ( self->citype == wanted_citype ) \
return self->##name; \
else \
return NULL; \
return nullptr; \
} \
%pythoncode { \
name = property(lambda self: self._get_##name()) \
@@ -829,7 +815,7 @@ cexpr_t *citem_t_cexpr_get(citem_t *item) { return (cexpr_t *) item; }
%ignore ctree_item_t::loc;
%{
treeloc_t *ctree_item_t_loc_get(ctree_item_t *item) { return item->citype == VDI_TAIL ? &item->loc : NULL; }
treeloc_t *ctree_item_t_loc_get(ctree_item_t *item) { return item->citype == VDI_TAIL ? &item->loc : nullptr; }
%}
#undef CTREE_CONDITIONAL_ITEM_MEMBER_REF
@@ -1009,7 +995,7 @@ void qswap(cinsn_t &a, cinsn_t &b);
if (!PyCallable_Check($1))
{
PyErr_SetString(PyExc_TypeError, "Need a callable object!");
return NULL;
return nullptr;
}
}
%enddef
+37
View File
@@ -29,6 +29,10 @@
%ignore setinf;
%ignore setinf_buf;
%ignore setinf_flag;
#ifdef NOTEAMS
%ignore idbattr_info_t;
%ignore idbattr_valmap_t;
#endif
%extend idainfo
{
@@ -50,6 +54,39 @@
}
}
%apply size_t { uintptr_t offset }
%extend idbattr_info_t
{
idbattr_info_t(
const char *name,
uintptr_t offset,
size_t width,
uint64 bitmask=0,
uchar tag=0,
uint idi_flags=0)
{
idbattr_info_t *ii = new idbattr_info_t();
#define DUPSTR(Prop) ii->Prop = Prop == nullptr ? nullptr : qstrdup(Prop)
DUPSTR(name);
#undef DUPSTR
ii->offset = offset;
ii->width = width;
ii->bitmask = bitmask;
ii->tag = tag;
ii->idi_flags = idi_flags;
return ii;
}
~idbattr_info_t()
{
#define FREESTR(Prop) qfree((char *) $self->Prop)
FREESTR(name);
#undef FREESTR
delete $self;
}
};
%ignore setflag(uchar &where,uchar bit,int value);
%ignore setflag(ushort &where,ushort bit,int value);
%ignore setflag(uint32 &where,uint32 bit,int value);
+2 -2
View File
@@ -39,8 +39,8 @@
// SWIG chokes on the original declaration so it is replicated here
typedef struct
{
ulonglong ival; // 8: integer value
ushort fval[6]; // 12: floating point value in the internal representation (see ieee.h)
uint64 ival; // 8: integer value
ushort fval[6]; // 12: floating point value in the internal representation (see ieee.h)
} regval_t;
%clear(op_dtype_t dtype);
+4
View File
@@ -64,6 +64,10 @@ struct undo_records_t;
%ignore get_hexdsp;
%ignore set_hexdsp;
%ignore remove_event_listener;
%ignore set_module_data;
%ignore clr_module_data;
%ignore get_module_data;
// @arnaud
%ignore notify__calc_next_eas;
+1 -1
View File
@@ -39,7 +39,7 @@
{
// %typemap(argout) (char *buf, size_t bufsize) (ieee.i specialization)
Py_XDECREF(resultobj);
$result = IDAPyStr_FromUTF8($1);
$result = PyUnicode_FromString($1);
}
%_uint_result_as_output(sval_t, PyLong_FromLong, result == REAL_ERROR_OK);
+10 -10
View File
@@ -245,11 +245,11 @@ struct py_action_handler_t : public action_handler_t
: pyah(borref_t(_o)), has_activate(false), has_update(false)
{
ref_t act(PyW_TryGetAttrString(pyah.o, "activate"));
if ( act != NULL && PyCallable_Check(act.o) > 0 )
if ( act != nullptr && PyCallable_Check(act.o) > 0 )
has_activate = true;
ref_t upd(PyW_TryGetAttrString(pyah.o, "update"));
if ( upd != NULL && PyCallable_Check(upd.o) > 0 )
if ( upd != nullptr && PyCallable_Check(upd.o) > 0 )
has_update = true;
}
virtual idaapi ~py_action_handler_t()
@@ -267,7 +267,7 @@ struct py_action_handler_t : public action_handler_t
PYW_GIL_GET_AND_REPORT_ERROR;
newref_t pyctx(SWIG_InternalNewPointerObj(SWIG_as_voidptr(ctx), SWIGTYPE_p_action_ctx_base_t, 0));
newref_t pyres(PyObject_CallMethod(pyah.o, (char *)"activate", (char *) "O", pyctx.o));
return PyErr_Occurred() ? 0 : ((pyres != NULL && IDAPyInt_Check(pyres.o)) ? IDAPyInt_AsLong(pyres.o) : 0);
return PyErr_Occurred() != nullptr ? 0 : ((pyres != nullptr && PyLong_Check(pyres.o)) ? PyLong_AsLong(pyres.o) : 0);
}
virtual action_state_t idaapi update(action_update_ctx_t *ctx)
{
@@ -276,7 +276,7 @@ struct py_action_handler_t : public action_handler_t
PYW_GIL_GET_AND_REPORT_ERROR;
newref_t pyctx(SWIG_InternalNewPointerObj(SWIG_as_voidptr(ctx), SWIGTYPE_p_action_ctx_base_t, 0));
newref_t pyres(PyObject_CallMethod(pyah.o, (char *)"update", (char *) "O", pyctx.o));
return PyErr_Occurred() ? AST_DISABLE_ALWAYS : ((pyres != NULL && IDAPyInt_Check(pyres.o)) ? action_state_t(IDAPyInt_AsLong(pyres.o)) : AST_DISABLE);
return PyErr_Occurred() != nullptr ? AST_DISABLE_ALWAYS : ((pyres != nullptr && PyLong_Check(pyres.o)) ? action_state_t(PyLong_AsLong(pyres.o)) : AST_DISABLE);
}
private:
@@ -290,9 +290,9 @@ private:
%inline %{
void refresh_choosers(void)
{
Py_BEGIN_ALLOW_THREADS;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
callui(ui_refresh_choosers);
Py_END_ALLOW_THREADS;
SWIG_PYTHON_THREAD_END_ALLOW;
}
%}
@@ -376,13 +376,13 @@ SWIG_DECLARE_PY_CLINKED_OBJECT(textctrl_info_t)
const char *name,
const char *label,
PyObject *handler,
const char *shortcut = NULL,
const char *tooltip = NULL,
const char *shortcut = nullptr,
const char *tooltip = nullptr,
int icon = -1,
int flags = 0)
{
action_desc_t *ad = new action_desc_t();
#define DUPSTR(Prop) ad->Prop = Prop == NULL ? NULL : qstrdup(Prop)
#define DUPSTR(Prop) ad->Prop = Prop == nullptr ? nullptr : qstrdup(Prop)
DUPSTR(name);
DUPSTR(label);
DUPSTR(shortcut);
@@ -397,7 +397,7 @@ SWIG_DECLARE_PY_CLINKED_OBJECT(textctrl_info_t)
~action_desc_t()
{
if ( $self->handler != NULL ) // Ownership not taken?
if ( $self->handler != nullptr ) // Ownership not taken?
delete $self->handler;
#define FREESTR(Prop) qfree((char *) $self->Prop)
FREESTR(name);
+1 -1
View File
@@ -46,7 +46,7 @@
Py_XDECREF(resultobj);
if (result >= 0)
{
resultobj = IDAPyStr_FromUTF8AndSize((const char *) $1->c_str(), $1->length());
resultobj = PyUnicode_FromStringAndSize((const char *) $1->c_str(), $1->length());
}
else
{
+12 -33
View File
@@ -34,12 +34,6 @@
%ignore extract_type_from_metadata;
%rename (extract_type_from_metadata) py_extract_type_from_metadata;
%rename (split_metadata) py_split_metadata;
%ignore swap_md5;
%ignore print_md5;
%ignore parse_md5;
%ignore auto_apply_lumina;
%ignore eavec_to_ea64vec;
%ignore ea64vec_to_eavec;
%feature("nodirector") simple_diff_handler_t;
@@ -74,33 +68,18 @@
//-------------------------------------------------------------------------
// metadata_t
//-------------------------------------------------------------------------
#ifdef PY3
%bytes_container_ptr_and_ref(
metadata_t,
begin,
size,
,
IDAPyBytes_Check,
IDAPyBytes_AsBytes,
IDAPyBytes_FromMemAndSize,
PyBytes_Check,
PyBytes_as_bytevec_t,
PyBytes_FromStringAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"bytes",
"bytes");
#else
%bytes_container_ptr_and_ref(
metadata_t,
begin,
size,
,
IDAPyBytes_Check,
IDAPyBytes_AsBytes,
IDAPyBytes_FromMemAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"string",
"str");
#endif
%make_argout_errbuf_raise_exception_when_non_empty();
@@ -120,12 +99,12 @@
//-------------------------------------------------------------------------
%typemap(in) (const uchar *ptr, const uchar *end) // for _wrap_extract_..._from_metadata
{
if ( !IDAPyBytes_Check($input) )
if ( !PyBytes_Check($input) )
SWIG_exception_fail(SWIG_TypeError, "Expected bytes in method '$symname', argument $argnum of type 'bytes'");
bytevec_t bytes;
char *buffer = nullptr;
Py_ssize_t length = 0;
if ( IDAPyBytes_AsMemAndSize($input, &buffer, &length) )
if ( PyBytes_AsStringAndSize($input, &buffer, &length) )
{
bytes.append(buffer, length);
$1 = bytes.begin();
@@ -138,7 +117,7 @@
%typemap(argout) (metadata_t *out_md)
{
// bytes_container typemap(argout) (metadata_t *out_md)
PyObject *py_md = IDAPyBytes_FromMemAndSize((const char *) $1->begin(), $1->size());
PyObject *py_md = PyBytes_FromStringAndSize((const char *) $1->begin(), $1->size());
$result = SWIG_Python_AppendOutput($result, py_md);
}
@@ -150,7 +129,7 @@
{
// typemap(in) md5_t *
qstring buf;
IDAPyStr_AsUTF8(&buf, $input);
PyUnicode_as_qstring(&buf, $input);
$1 = new md5_t;
memmove($1->hash, buf.c_str(), qmin(sizeof($1->hash), buf.length()));
}
@@ -163,7 +142,7 @@
%typemap(out) md5_t *
{ // typemap(out) md5_t *
$result = IDAPyBytes_FromMemAndSize((const char *) $1->hash, sizeof($1->hash));
$result = PyBytes_FromStringAndSize((const char *) $1->hash, sizeof($1->hash));
}
// suppress the output parameter as an input.
@@ -175,18 +154,18 @@
%typemap(argout) (md5_t *out)
{
// typemap(argout) (md5_t *out)
PyObject *py_hash = IDAPyBytes_FromMemAndSize((const char *) $1->hash, sizeof($1->hash));
PyObject *py_hash = PyBytes_FromStringAndSize((const char *) $1->hash, sizeof($1->hash));
$result = SWIG_Python_AppendOutput($result, py_hash);
}
%apply md5_t *out { md5_t *out_hash };
%apply longlong *INPUT { const int64 * };
%apply int64 *INPUT { const int64 * };
%typemap(directorin) const int64 *
{ // %typemap(directorin) const int64 *
if ( $1 != NULL )
if ( $1 != nullptr )
{
$input = PyLong_FromLongLong(longlong(*($1)));
$input = PyLong_FromLongLong(int64(*($1)));
}
else
{
+160
View File
@@ -0,0 +1,160 @@
%{
#include <merge.hpp>
%}
// diff3.hpp
typedef int diff_source_idx_t;
%ignore merge_node_info_t;
%rename(merge_node_info_t) merge_node_info2_t;
%ignore create_nodeval_merge_handler;
%rename(create_nodeval_merge_handler) create_nodeval_merge_handler2;
%ignore create_nodeval_merge_handlers;
%rename(create_nodeval_merge_handlers) create_nodeval_merge_handlers2;
// for dump_merge_results() only
%ignore merge_node_helper_t::get_logname;
// FIXME: do not know how to handle
%ignore merge_node_helper_t::map_value;
// for C++ only, hide kernel data
%ignore merge_data_t::mappers;
// void merge_data_t::operator=(const merge_data_t&) = deleted
%immutable merge_handler_params_t::md;
// kernel only
%ignore MH_DUMMY;
// no need to create new instances
%feature("nodirector") merge_data_t;
%ignore merge_data_t::merge_data_t;
%ignore merge_data_t::~merge_data_t;
%typemap(check) (const char *_module_name) (qstring tmp) {
tmp = $1;
$1 = tmp.extract();
}
%typemap(check) (const char *_netnode_name) (qstring tmp) {
tmp = $1;
$1 = tmp.extract();
}
%typemap(in,numinputs=1) (const idbattr_info_t *_fields, size_t _nfields) (qvector<idbattr_info_t> temp)
{
if ( !PySequence_Check($input) )
{
PyErr_SetString(PyExc_TypeError, "Expecting a list of `idbattr_info_t` instances");
return nullptr;
}
PyObject *s = $input;
Py_ssize_t len = PySequence_Size(s);
temp.reserve(len);
for ( Py_ssize_t i = 0; i < len; ++i )
{
newref_t o(PySequence_GetItem(s, i));
void *ap = 0 ;
int cvt = SWIG_ConvertPtr(o.o, &ap, SWIGTYPE_p_idbattr_info_t, 0);
if ( !SWIG_IsOK(cvt) )
SWIG_exception_fail(
SWIG_ArgError(cvt),
"in method '" "$symname" "', argument " "$argnum"" consists of 'idbattr_info_t' instances");
temp.push_back(*reinterpret_cast<idbattr_info_t*>(ap));
}
$2 = temp.size();
$1 = temp.extract();
}
%apply char { uchar tag };
%extend merge_node_info2_t
{
/// \param name name of the array (label)
/// \param tag a tag used to access values in the netnode
/// \param nds_flags node value attributes (a combination of \ref nds_flags_t)
/// \param node_helper merge handler creation helper
merge_node_info2_t(
const char *name,
uchar tag,
uint32 nds_flags,
merge_node_helper_t *node_helper=nullptr)
{
merge_node_info2_t *ii = new merge_node_info2_t();
ii->name = name == nullptr ? nullptr : qstrdup(name);
ii->tag = tag;
ii->nds_flags = nds_flags;
ii->node_helper = node_helper;
return ii;
}
~merge_node_info2_t()
{
qfree((char *) $self->name);
delete $self;
}
}
// For:
// merge_node_helper_t::print_entry_details
// merge_node_helper_t::get_column_headers
%typemap(directorargout) qstrvec_t * (qstrvec_t tmp)
{ // %typemap(directorargout) qstrvec_t *
if ( $result != Py_None )
{
if ( PyW_PyListToStrVec(&tmp, $result) >= 0 )
{
$1->insert($1->end(), tmp.begin(), tmp.end());
}
else
{
Swig::DirectorTypeMismatchException::raise(
SWIG_ErrorType(SWIG_TypeError),
"in output value of type 'qstrvec_t' in method '$symname'");
}
}
}
// idaman void ida_export create_nodeval_merge_handlers2(
// merge_handlers_t *out,
// const merge_handler_params_t &mhp,
// int moddata_id,
// const char *nodename,
// const merge_node_info2_t *valdesc,
// size_t nvals,
// bool skip_empty_nodes = true);
%typemap(in,numinputs=0) (int moddata_id) { $1 = -1; }
%typemap(in,numinputs=1) (const merge_node_info2_t *valdesc, size_t nvals) (qvector<merge_node_info2_t> temp)
{
if ( $input == Py_None )
{
$2 = 0;
$1 = nullptr;
}
else
{
if ( !PySequence_Check($input) )
{
PyErr_SetString(PyExc_TypeError, "Expecting a list of `merge_node_info2_t` instances");
return nullptr;
}
PyObject *s = $input;
Py_ssize_t len = PySequence_Size(s);
temp.reserve(len);
for ( Py_ssize_t i = 0; i < len; ++i )
{
newref_t o(PySequence_GetItem(s, i));
void *ap = 0 ;
int cvt = SWIG_ConvertPtr(o.o, &ap, SWIGTYPE_p_merge_node_info2_t, 0);
if ( !SWIG_IsOK(cvt) )
SWIG_exception_fail(
SWIG_ArgError(cvt),
"in method '" "$symname" "', argument " "$argnum"" consists of 'merge_node_info2_t' instances");
temp.push_back(*reinterpret_cast<merge_node_info2_t*>(ap));
}
$2 = temp.size();
$1 = temp.extract();
}
}
%include "merge.hpp"
+53
View File
@@ -0,0 +1,53 @@
%{
#include <mergemod.hpp>
%}
%ignore create_std_modmerge_handlers;
%rename(create_std_modmerge_handlers) create_std_modmerge_handlers2;
// Prototype of the custom function to create merge handlers
%ignore create_merge_handlers;
// idaman void ida_export create_std_modmerge_handlers2(
// merge_handler_params_t &mhp,
// int moddata_id,
// moddata_diff_helper_t &helper,
// const merge_node_info2_t *merge_node_info=nullptr,
// size_t n_merge_node_info=0);
%typemap(in,numinputs=0) (int moddata_id) { $1 = -1; }
%typemap(in,numinputs=1) (const merge_node_info2_t *merge_node_info, size_t n_merge_node_info) (qvector<merge_node_info2_t> temp)
{
if ( $input == Py_None )
{
$2 = 0;
$1 = nullptr;
}
else
{
if ( !PySequence_Check($input) )
{
PyErr_SetString(PyExc_TypeError, "Expecting a list of `merge_node_info2_t` instances");
return nullptr;
}
PyObject *s = $input;
Py_ssize_t len = PySequence_Size(s);
temp.reserve(len);
for ( Py_ssize_t i = 0; i < len; ++i )
{
newref_t o(PySequence_GetItem(s, i));
void *ap = 0 ;
int cvt = SWIG_ConvertPtr(o.o, &ap, SWIGTYPE_p_merge_node_info2_t, 0);
if ( !SWIG_IsOK(cvt) )
SWIG_exception_fail(
SWIG_ArgError(cvt),
"in method '" "$symname" "', argument " "$argnum"" consists of 'merge_node_info2_t' instances");
temp.push_back(*reinterpret_cast<merge_node_info2_t*>(ap));
}
$2 = temp.size();
$1 = temp.extract();
}
}
%include "mergemod.hpp"
+6
View File
@@ -11,6 +11,12 @@
%ignore enum_import_names;
%rename (enum_import_names) py_enum_import_names;
%typemap(check) (const char* text, size_t size) {
size_t len = $1 != nullptr ? qstrlen($1) : 0;
if ( $2 > len )
$2 = len;
}
%ignore calc_nodeidx;
%ignore get_wide_value;
+6 -7
View File
@@ -115,6 +115,7 @@
%ignore netnode::validate_names;
%constant nodeidx_t BADNODE = nodeidx_t(-1);
%constant size_t SIZEOF_nodeidx_t = sizeof(nodeidx_t);
// Renaming one version of hashset() otherwise SWIG will not be able to activate the other one
%rename (hashset_idx) netnode::hashset(const char *idx, nodeidx_t value, uchar tag=htag);
@@ -135,7 +136,7 @@
bytevec_t blob;
if ( self->getblob(&blob, start, uchar(tag)) <= 0 )
Py_RETURN_NONE;
return IDAPyBytes_FromMemAndSize((const char *)blob.begin(), blob.size());
return PyBytes_FromStringAndSize((const char *)blob.begin(), blob.size());
}
PyObject *getclob(nodeidx_t start, char tag)
@@ -143,7 +144,7 @@
qstring clob;
if ( self->getblob(&clob, start, uchar(tag)) <= 0 )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8AndSize((const char *)clob.begin(), clob.length());
return PyUnicode_FromStringAndSize((const char *)clob.begin(), clob.length());
}
PyObject *getblob_ea(ea_t ea, char tag)
@@ -151,7 +152,7 @@
bytevec_t blob;
if ( self->getblob(&blob, ea, tag) <= 0 )
Py_RETURN_NONE;
return IDAPyBytes_FromMemAndSize((const char *)blob.begin(), blob.size());
return PyBytes_FromStringAndSize((const char *)blob.begin(), blob.size());
}
PyObject *hashstr_buf(const char *idx, char tag=htag)
@@ -161,17 +162,16 @@
if ( sz < 0 )
Py_RETURN_NONE;
else
return IDAPyStr_FromUTF8AndSize(buf, sz);
return PyUnicode_FromStringAndSize(buf, sz);
}
bool hashset_buf(const char *idx, PyObject *py_str, char tag=htag)
{
qstring buf;
return IDAPyStr_AsUTF8(&buf, py_str)
return PyUnicode_as_qstring(&buf, py_str)
&& self->hashset(idx, buf.c_str(), buf.length(), uchar(tag));
}
#ifdef PY3
bool supset(nodeidx_t alt, const char *value, size_t length=0, uchar tag=stag)
{
return self->supset(alt, (void *) value, length, tag);
@@ -181,5 +181,4 @@
{
return self->supset_ea(ea, (void *) value, length, tag);
}
#endif
}
+10 -5
View File
@@ -39,6 +39,9 @@
%ignore unpack_memory;
%ignore cliopt_t;
%ignore cliopts_t;
%ignore plugin_option_t;
%ignore plugins_option_t;
%ignore parse_plugin_options;
%ignore test_bit;
%ignore set_bit;
%ignore set_bits;
@@ -46,6 +49,8 @@
%ignore clear_bits;
%ignore set_all_bits;
%ignore clear_all_bits;
%ignore calc_file_crc32;
%ignore calc_crc32;
%extend qrefcnt_t {
size_t __ptrval__() const
@@ -88,11 +93,11 @@ void qvector<unsigned long long>::grow(const unsigned long long &x=0);
%ignore qvector<unsigned long long>::grow;
//---------------------------------------------------------------------
%template(intvec_t) qvector<int>;
%template(uintvec_t) qvector<unsigned int>;
%template(longlongvec_t) qvector<long long>;
%template(ulonglongvec_t) qvector<unsigned long long>;
%template(boolvec_t) qvector<bool>;
%template(intvec_t) qvector<int>;
%template(uintvec_t) qvector<unsigned int>;
%template(int64vec_t) qvector<long long>;
%template(uint64vec_t) qvector<unsigned long long>;
%template(boolvec_t) qvector<bool>;
%uncomparable_elements_qvector(simpleline_t, strvec_t);
%template(sizevec_t) qvector<size_t>;
+11 -2
View File
@@ -12,6 +12,11 @@
%ignore rebase_program;
%rename (rebase_program) py_rebase_program;
%template (segment_defsr_array) wrapped_array_t<sel_t,SREG_NUM>;
%pywraps_nonnul_argument_prototype(
bool set_segment_translations(ea_t segstart, const eavec_t &transmap),
const eavec_t &transmap);
%{
//<code(py_segment)>
//</code(py_segment)>
@@ -21,16 +26,20 @@
{
ea_t start_ea;
ea_t end_ea;
wrapped_array_t<sel_t,SREG_NUM> __getDefsr() {
return wrapped_array_t<sel_t,SREG_NUM>($self->defsr);
}
%pythoncode {
use64 = is_64bit
defsr = property(__getDefsr)
}
}
#ifdef __EA64__
%apply ulonglong *OUTPUT { sel_t *sel, ea_t *base }; // getn_selector()
%apply uint64 *OUTPUT { sel_t *sel, ea_t *base }; // getn_selector()
#else
%apply unsigned int *OUTPUT { sel_t *sel, ea_t *base }; // getn_selector()
%apply uint *OUTPUT { sel_t *sel, ea_t *base }; // getn_selector()
#endif
%typemap(check) (sel_t *sel, ea_t *base) {
+5 -5
View File
@@ -28,20 +28,20 @@
for ( size_t i = 0; i < n; ++i )
{
newref_t pyo(PySequence_GetItem(py_t, i));
if ( IDAPyInt_Check(pyo.o) )
if ( PyLong_Check(pyo.o) )
{
long stype = IDAPyInt_AsLong(pyo.o);
long stype = PyLong_AsLong(pyo.o);
if ( stype < 0 || stype >= 0x100 )
{
PyErr_SetString(PyExc_ValueError, "values must be between 0 & 0x100");
return NULL;
return nullptr;
}
t.push_back(uchar(stype));
}
else
{
PyErr_SetString(PyExc_ValueError, "expected an integer");
return NULL;
return nullptr;
}
}
$self->strtypes.swap(t);
@@ -49,7 +49,7 @@
else
{
PyErr_SetString(PyExc_TypeError, "expected a list");
return NULL;
return nullptr;
}
Py_RETURN_TRUE;
}
+1 -1
View File
@@ -20,7 +20,7 @@
%typemap(argout) qstring *out_mname {
if (result)
{
%append_output(IDAPyStr_FromUTF8AndSize($1->begin(), $1->length()));
%append_output(PyUnicode_FromStringAndSize($1->begin(), $1->length()));
}
else
{
+6 -6
View File
@@ -156,7 +156,7 @@
til_t *base(int n)
{
return (n < 0 || n >= $self->nbases) ? NULL : $self->base[n];
return (n < 0 || n >= $self->nbases) ? nullptr : $self->base[n];
}
}
@@ -173,9 +173,9 @@
const til_t *til,
const type_t *type,
const p_list *fields,
const p_list *cmts = NULL)
const p_list *cmts = nullptr)
{
return $self->deserialize(til, &type, &fields, cmts == NULL ? NULL : &cmts);
return $self->deserialize(til, &type, &fields, cmts == nullptr ? nullptr : &cmts);
}
tinfo_t copy() const
@@ -241,7 +241,7 @@
{
bytevec_t bv;
if ( $self->get_attr(key, &bv, all_attrs) )
return IDAPyStr_FromUTF8AndSize((const char *) bv.begin(), bv.size());
return PyUnicode_FromStringAndSize((const char *) bv.begin(), bv.size());
else
Py_RETURN_NONE;
}
@@ -264,8 +264,8 @@
// %typemap(in) const sclass_t *
if ( $input == Py_None )
$1 = new sclass_t(sc_unk);
else if ( IDAPyInt_Check($input) )
$1 = new sclass_t(sclass_t(IDAPyInt_AsLong($input)));
else if ( PyLong_Check($input) )
$1 = new sclass_t(sclass_t(PyLong_AsLong($input)));
else
SWIG_exception_fail(
SWIG_ValueError,
-2
View File
@@ -145,10 +145,8 @@
%apply ea_t { adiff_t off };
%apply ea_t { adiff_t off };
#ifdef PY3
%apply uchar { char segpref };
%apply uchar { char insnpref };
#endif
%include "ua.hpp"
-11
View File
@@ -72,14 +72,3 @@ So far it seems that only the following options are required:
...
Everything else can be removed.
Python 2
========
The same approach can be used for Python2, but instead use:
$ cp /System/Library/Frameworks/Python.framework/Versions/2.7/Python /tmp/
and use this install name instead:
install-name: '@executable_path/libpython2.link.dylib'
+7 -7
View File
@@ -119,11 +119,11 @@ def check_cpp(args):
"_wrap_warning__varargs__" : {
"nullptrcheck" : 1, # 1st arg
"mustcall" : "IDAPyStr_AsUTF8",
"mustcall" : "PyUnicode_as_qstring",
},
"_wrap_error__varargs__" : {
"nullptrcheck" : 1,
"mustcall" : "IDAPyStr_AsUTF8",
"mustcall" : "PyUnicode_as_qstring",
},
"_wrap_tag_remove" : {
"nullptrcheck" : 1,
@@ -156,19 +156,19 @@ def check_cpp(args):
functions_coherence_hexrays = {
"_wrap_cfuncptr_t___str__" : {
"mustcall" : ["cfunc_t___str__", "IDAPyStr_FromUTF8AndSize"],
"mustcall" : ["cfunc_t___str__", "PyUnicode_FromStringAndSize"],
},
"_wrap_cfunc_t___str__" : {
"mustcall" : ["cfunc_t___str__", "IDAPyStr_FromUTF8AndSize"],
"mustcall" : ["cfunc_t___str__", "PyUnicode_FromStringAndSize"],
},
"_wrap_hexrays_failure_t_desc" : {
"mustcall" : "IDAPyStr_FromUTF8AndSize",
"mustcall" : "PyUnicode_FromStringAndSize",
},
"_wrap_vd_failure_t_desc" : {
"mustcall" : "IDAPyStr_FromUTF8AndSize",
"mustcall" : "PyUnicode_FromStringAndSize",
},
"_wrap_create_field_name" : {
"mustcall" : "IDAPyStr_FromUTF8AndSize",
"mustcall" : "PyUnicode_FromStringAndSize",
},
"delete_qrefcnt_t_Sl_cfunc_t_Sg_" : {
"mustcall" : "hexrays_deregister_python_clearable_instance",
+2 -6
View File
@@ -9,11 +9,7 @@ import sys, re, os, glob
major, minor, micro, _, _ = sys.version_info
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-t", "--template", required=True)
@@ -56,7 +52,7 @@ if xml_tree is not None:
name, ptyp, desc = tpl
signature.append("%s %s" % (ptyp, name or ""))
if relevant_and_non_null(ptyp, desc):
body.append("if ( $%d == NULL )" % (idx+1))
body.append("if ( $%d == nullptr )" % (idx+1))
body.append(""" SWIG_exception_fail(SWIG_ValueError, "invalid null reference in method '$symname', argument $argnum of type '$%d_type'");""" % (idx+1))
pass
typemaps.append("%%typemap(check) (%s)" % ", ".join(signature))
+87 -157
View File
@@ -14,10 +14,6 @@
#define DEPRECATED
%}
%{
#include "../../../idapy.hpp"
%}
#define SWIG_PYTHON_LEGACY_BOOL 1
// Have SWiG flatten the hierarchy of types
@@ -67,6 +63,10 @@ extern plugin_t PLUGIN;
#pragma SWIG nowarn=451
#pragma SWIG nowarn=454 // Setting a pointer/reference variable may leak memory
#pragma SWIG nowarn=514 // Director base class 'x' has no virtual destructor.
#pragma SWIG nowarn=350 // operator new ignored
#pragma SWIG nowarn=394 // operator new[] ignored
#pragma SWIG nowarn=395 // operator delete[] ignored
#pragma SWIG nowarn=351 // operator delete ignored
// Do not create separate wrappers for default arguments
%feature("compactdefaultargs");
@@ -395,7 +395,7 @@ class QLIST_TYPE##_iterator {};
inline size_t strnlen(const char *s, size_t maxlen)
{
const char *found = (const char *) memchr(s, 0, maxlen);
return found != NULL ? size_t(found - s) : maxlen;
return found != nullptr ? size_t(found - s) : maxlen;
}
#endif
#endif
@@ -406,7 +406,7 @@ inline size_t strnlen(const char *s, size_t maxlen)
static PyObject *type##_create()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
return PyCapsule_New(new type(), VALID_CAPSULE_NAME, NULL);
return PyCapsule_New(new type(), VALID_CAPSULE_NAME, nullptr);
}
static bool type##_destroy(PyObject *py_obj)
{
@@ -437,12 +437,11 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
%typemap(directorout) PyObject * "/*%dout%*/$result = result;Py_XINCREF($result);"
//---------------------------------------------------------------------
#ifdef PY3
%define %treat_serialized_tinfo_raw_pointer_as_bytes_1(_TYPE)
%typemap(in) _TYPE *
{ // %treat_serialized_tinfo_raw_pointer_as_bytes_1 %typemap(in) _TYPE *
if ( $input == Py_None )
$1 = ($1_ltype) NULL;
$1 = ($1_ltype) nullptr;
else if ( PyBytes_Check($input) )
$1 = ($1_ltype) PyBytes_AsString($input);
else
@@ -452,11 +451,11 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
}
%typemap(directorin) _TYPE *
{ // %treat_serialized_tinfo_raw_pointer_as_bytes_1 %typemap(directorin) _TYPE *
$input = PyBytes_FromString($1 != NULL ? (const char *) $1 : "");
$input = PyBytes_FromString($1 != nullptr ? (const char *) $1 : "");
}
%typemap(out) _TYPE *
{ // %treat_serialized_tinfo_raw_pointer_as_bytes_1 %typemap(out) _TYPE *
$result = PyBytes_FromString($1 != NULL ? (const char *) $1 : "");
$result = PyBytes_FromString($1 != nullptr ? (const char *) $1 : "");
}
// 'typecheck' typemaps are used for polymorphism. We want to favor
// tinfo_t wrappers at the expense of 'type_t *' ones, so we want the
@@ -470,12 +469,6 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
%treat_serialized_tinfo_raw_pointer_as_bytes_1(TYPE);
%treat_serialized_tinfo_raw_pointer_as_bytes_1(const TYPE);
%enddef
#else
%define %treat_serialized_tinfo_raw_pointer_as_bytes(TYPE)
%apply char * { TYPE * }
%apply const char * { const TYPE * }
%enddef
#endif
%treat_serialized_tinfo_raw_pointer_as_bytes(type_t);
%treat_serialized_tinfo_raw_pointer_as_bytes(p_list);
@@ -511,7 +504,7 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
if (!PySequence_Check($input))
{
PyErr_SetString(PyExc_TypeError,"Expecting a sequence");
return NULL;
return nullptr;
}
/* Cap the number of elements to copy */
@@ -523,7 +516,7 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
if (!PyLong_Check(item.o))
{
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of long integers");
return NULL;
return nullptr;
}
temp[i] = PyLong_AsUnsignedLong(item.o);
@@ -537,13 +530,13 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
if (!PySequence_Check($input))
{
PyErr_SetString(PyExc_TypeError,"Expecting a sequence");
return NULL;
return nullptr;
}
int plen = PySequence_Length($input);
if ( plen <= 0 )
{
PyErr_SetString(PyExc_TypeError, "Sequence must have at least 1 item");
return NULL;
return nullptr;
}
temp.resize(plen);
for ( int i =0; i < plen; ++i )
@@ -552,7 +545,7 @@ static PyObject *type##_get_clink_ptr(PyObject *self)
if (!PyLong_Check(item.o))
{
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of long integers");
return NULL;
return nullptr;
}
temp[i] = PyLong_AsUnsignedLong(item.o);
@@ -570,7 +563,7 @@ SWIGINTERN PyObject *_maybe_cstring_result(
Py_XDECREF(resultobj);
if ( result <= 0 )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8(cstr);
return PyUnicode_FromString(cstr);
}
SWIGINTERN PyObject *_sized_cstring_result(
@@ -579,7 +572,7 @@ SWIGINTERN PyObject *_sized_cstring_result(
size_t cstrsz)
{
Py_XDECREF(resultobj);
return IDAPyStr_FromUTF8AndSize(cstr, cstrsz);
return PyUnicode_FromStringAndSize(cstr, cstrsz);
}
SWIGINTERN PyObject *_maybe_sized_cstring_result(
@@ -591,7 +584,7 @@ SWIGINTERN PyObject *_maybe_sized_cstring_result(
Py_XDECREF(resultobj);
if ( result <= 0 )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8AndSize(cstr, cstrsz);
return PyUnicode_FromStringAndSize(cstr, cstrsz);
}
SWIGINTERN PyObject *_maybe_cstring_result_on_charptr_using_allocated_buf(
@@ -600,10 +593,10 @@ SWIGINTERN PyObject *_maybe_cstring_result_on_charptr_using_allocated_buf(
char *buf)
{
Py_XDECREF(resultobj);
PyObject *out = NULL;
if ( result != NULL )
PyObject *out = nullptr;
if ( result != nullptr )
{
out = IDAPyStr_FromUTF8(buf);
out = PyUnicode_FromString(buf);
}
else
{
@@ -620,9 +613,9 @@ SWIGINTERN PyObject *_maybe_cstring_result_on_charptr_using_qbuf(
const qstring &buf)
{
Py_XDECREF(resultobj);
if ( result == NULL )
if ( result == nullptr )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8AndSize(buf.begin(), buf.length());
return PyUnicode_FromStringAndSize(buf.begin(), buf.length());
}
SWIGINTERN PyObject *_maybe_binary_result(
@@ -633,11 +626,7 @@ SWIGINTERN PyObject *_maybe_binary_result(
Py_XDECREF(resultobj);
if ( result <= 0 )
Py_RETURN_NONE;
#ifdef PY3
return PyBytes_FromStringAndSize((const char *) buf, result);
#else
return PyString_FromStringAndSize((const char *) buf, result);
#endif
}
SWIGINTERN PyObject *_sized_binary_result(
@@ -646,7 +635,7 @@ SWIGINTERN PyObject *_sized_binary_result(
size_t cstrsz)
{
Py_XDECREF(resultobj);
return IDAPyBytes_FromMemAndSize(cstr, cstrsz);
return PyBytes_FromStringAndSize(cstr, cstrsz);
}
SWIGINTERN PyObject *_maybe_sized_binary_result(
@@ -658,7 +647,7 @@ SWIGINTERN PyObject *_maybe_sized_binary_result(
Py_XDECREF(resultobj);
if ( result <= 0 )
Py_RETURN_NONE;
return IDAPyBytes_FromMemAndSize(cstr, cstrsz);
return PyBytes_FromStringAndSize(cstr, cstrsz);
}
%}
@@ -666,7 +655,6 @@ SWIGINTERN PyObject *_maybe_sized_binary_result(
#if defined(IDA_MODULE_NALT)
%{
#include <bytes.hpp>
#ifdef PY3
SWIGINTERN PyObject *_maybe_byte_array_or_none_result(
PyObject *resultobj,
bool result,
@@ -676,24 +664,8 @@ SWIGINTERN PyObject *_maybe_byte_array_or_none_result(
Py_XDECREF(resultobj);
if ( !result )
Py_RETURN_NONE;
return IDAPyBytes_FromMemAndSize((const char *) bytes, nbytes);
return PyBytes_FromStringAndSize((const char *) bytes, nbytes);
}
#else
SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
PyObject *resultobj,
bool result,
const uchar *bytes,
size_t nbytes)
{
Py_XDECREF(resultobj);
if ( !result )
Py_RETURN_NONE;
qstring buf;
buf.resize(2*nbytes);
get_hex_string(buf.begin(), buf.size(), bytes, nbytes);
return IDAPyBytes_FromMemAndSize(buf.c_str(), buf.length());
}
#endif
%}
#endif
@@ -777,7 +749,6 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
//-------------------------------------------------------------------------
// md5/sha256 hash retrieval (as hex representation)
//-------------------------------------------------------------------------
#ifdef PY3
%define %byte_array_or_none(PARAM_NAME)
%typemap(in, numinputs=0) uchar PARAM_NAME[ANY] (uchar temp[$1_dim0])
{ // byte_array_or_none typemap(in, numinputs=0) uchar PARAM_NAME[ANY] (uchar temp[$1_dim0])
@@ -789,26 +760,13 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
}
%enddef
%byte_array_or_none(hash);
#else
%define %byte_array_as_hex_or_none(PARAM_NAME)
%typemap(in, numinputs=0) uchar PARAM_NAME[ANY] (uchar temp[$1_dim0])
{ // byte_array_as_hex_or_none typemap(in, numinputs=0) uchar PARAM_NAME[ANY] (uchar temp[$1_dim0])
$1 = temp;
}
%typemap(argout) uchar PARAM_NAME[ANY]
{ // byte_array_as_hex_or_none typemap(argout) uchar PARAM_NAME[ANY]
resultobj = _maybe_byte_array_as_hex_or_none_result(resultobj, result, $1, $1_dim0);
}
%enddef
%byte_array_as_hex_or_none(hash);
#endif
// Check that the argument is a callable Python object
//---------------------------------------------------------------------
%typemap(in) PyObject *pyfunc {
if (!PyCallable_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Expected a callable object");
return NULL;
return nullptr;
}
$1 = $input;
}
@@ -817,7 +775,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in) PyObject *pyfunc_or_none {
if ($input != Py_None && !PyCallable_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Expected None or a callable object");
return NULL;
return nullptr;
}
$1 = $input;
}
@@ -826,7 +784,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in) PyObject *tuple_or_none {
if ($input != Py_None && !PyTuple_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Expected None or a tuple");
return NULL;
return nullptr;
}
$1 = $input;
}
@@ -904,7 +862,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
{
CONTAINER_TYPE *cvt_##CONTAINER_TYPE(PyObject *obj, bool can_be_none=false)
{
CONTAINER_TYPE *out = NULL;
CONTAINER_TYPE *out = nullptr;
if ( can_be_none && obj == Py_None )
{
out = new CONTAINER_TYPE;
@@ -922,7 +880,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in, fragment="cvt_" #CONTAINER_TYPE) REFTYPE
{ // bytes_container REFTYPE, CONTAINER_TYPE typemap(in)
$1 = cvt_ ## CONTAINER_TYPE($input);
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(
SWIG_ValueError,
"Expected " ELTYPE_TO_REPORT1 " " "in method '" "$symname" "', argument " "$argnum"" of type '" ELTYPE_TO_REPORT2 "'");
@@ -931,7 +889,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in) const REFTYPE _type_or_none
{ // bytes_container REFTYPE _type_or_none, CONTAINER_TYPE typemap(in)
$1 = cvt_ ## CONTAINER_TYPE($input, /*can_be_none=*/ true);
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(
SWIG_ValueError,
"Expected " ELTYPE_TO_REPORT1 " " "in method '" "$symname" "', argument " "$argnum"" of type '" ELTYPE_TO_REPORT2 "'");
@@ -939,7 +897,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in) const REFTYPE _fields
{ // bytes_container REFTYPE _fields, CONTAINER_TYPE typemap(in)
$1 = cvt_ ## CONTAINER_TYPE($input, /*can_be_none=*/ true);
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(
SWIG_ValueError,
"Expected " ELTYPE_TO_REPORT1 " " "in method '" "$symname" "', argument " "$argnum"" of type '" ELTYPE_TO_REPORT2 "'");
@@ -1014,7 +972,7 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
}
%typemap(directorin) CONTAINER_TYPE *
{ // bytes_container typemap(directorin) CONTAINER_TYPE *
if ( $1 != NULL )
if ( $1 != nullptr )
{
$input = OUT_CONVERTER($1->START_ACCESSOR(), $1->SIZE_ACCESSOR());
}
@@ -1089,15 +1047,14 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%enddef
#ifdef PY3
%bytes_container_ptr_and_ref(
qstring,
c_str,
length,
,
IDAPyStr_Check,
IDAPyStr_AsUTF8,
IDAPyStr_FromUTF8AndSize,
PyUnicode_Check,
PyUnicode_as_qstring,
PyUnicode_FromStringAndSize,
_sized_cstring_result,
_maybe_sized_cstring_result,
"string",
@@ -1107,9 +1064,9 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
begin,
size,
,
IDAPyBytes_Check,
IDAPyBytes_AsBytes,
IDAPyBytes_FromMemAndSize,
PyBytes_Check,
PyBytes_as_bytevec_t,
PyBytes_FromStringAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"bytes",
@@ -1119,51 +1076,13 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
begin,
length,
(const uchar *),
IDAPyBytes_Check,
IDAPyBytes_as_qtype,
IDAPyBytes_FromMemAndSize,
PyBytes_Check,
PyBytes_as_qtype,
PyBytes_FromStringAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"bytes",
"bytes");
#else
%bytes_container_ptr_and_ref(
qstring,
c_str,
length,
,
IDAPyStr_Check,
IDAPyStr_AsUTF8,
IDAPyStr_FromUTF8AndSize,
_sized_cstring_result,
_maybe_sized_cstring_result,
"string",
"str");
%bytes_container_ptr_and_ref(
bytevec_t,
begin,
size,
,
IDAPyBytes_Check,
IDAPyBytes_AsBytes,
IDAPyBytes_FromMemAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"string",
"str");
%bytes_container_ptr_and_ref(
qtype,
begin,
length,
(const uchar *),
IDAPyBytes_Check,
IDAPyBytes_as_qtype,
IDAPyBytes_FromMemAndSize,
_sized_binary_result,
_maybe_sized_binary_result,
"string",
"str");
#endif
//-------------------------------------------------------------------------
// insn_t
@@ -1209,11 +1128,11 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
%typemap(in) (const char *format, ...) (qstring buf)
{
$1 = "%s"; /* Fix format string to %s */
IDAPyStr_AsUTF8(&buf, $input); /* Get string argument */
PyUnicode_as_qstring(&buf, $input); /* Get string argument */
$2 = (void *) buf.begin();
/* Note: we cannot rely on 'nonnul_argument_prototype' for */
/* these, since we fiddle with the arguments number */
if ( $2 == NULL )
if ( $2 == nullptr )
SWIG_exception_fail(
SWIG_ValueError,
"invalid null pointer " "in method '" "$symname" "', argument " "$argnum"" of type '" "$1_type""'");
@@ -1226,24 +1145,37 @@ SWIGINTERN PyObject *_maybe_byte_array_as_hex_or_none_result(
$1 = size_t(PyLong_AsUnsignedLongLong($input));
}
// Help SWIG to figure out the ulonglong type
#ifdef SWIGWIN
typedef unsigned __int64 ulonglong;
typedef __int64 longlong;
typedef unsigned __int64 uint64;
typedef __int64 int64;
#else
typedef unsigned long long ulonglong;
typedef long long longlong;
typedef unsigned long long uint64;
typedef long long int64;
#endif
#ifdef __NT__
%{
CASSERT(sizeof(time_t) == sizeof(int64));
%}
typedef int64 time_t;
#else
%{
CASSERT(sizeof(time_t) == sizeof(long int));
%}
typedef long int time_t;
#endif
typedef int ui_notification_t;
#ifdef __EA64__
%apply longlong *INOUT { sval_t *value };
%apply longlong *INOUT { adiff_t *disp };
%apply ulonglong *INOUT { ea_t *addr };
%apply ulonglong *INPUT { ea_t *ea_ptr }; // get_debug_name
%apply ulonglong *INOUT { sel_t *sel };
%apply ulonglong *OUTPUT { ea_t *ea1, ea_t *ea2 }; // read_range_selection()
%apply ulonglong *OUTPUT { ea_t *from, ea_t *to, asize_t *size }; // get_mapping()
%apply ulonglong *OUTPUT { uval_t *value }; // get_name_value
%apply int64 *INOUT { sval_t *value };
%apply int64 *INOUT { adiff_t *disp };
%apply uint64 *INOUT { ea_t *addr };
%apply uint64 *INPUT { ea_t *ea_ptr }; // get_debug_name
%apply uint64 *INOUT { sel_t *sel };
%apply uint64 *OUTPUT { ea_t *ea1, ea_t *ea2 }; // read_range_selection()
%apply uint64 *OUTPUT { ea_t *from, ea_t *to, asize_t *size }; // get_mapping()
%apply uint64 *OUTPUT { uval_t *value }; // get_name_value
#else
%apply int *INOUT { sval_t *value };
%apply int *INOUT { adiff_t *disp };
@@ -1274,7 +1206,7 @@ typedef long long longlong;
// %typemap(argout) qstring *errbuf (from: %make_argout_errbuf_raise_exception_when_non_empty)
if ( !$1->empty() )
{
if ( $result != NULL )
if ( $result != nullptr )
Py_XDECREF($result);
SWIG_exception_fail(SWIG_RuntimeError, $1->c_str());
}
@@ -1285,9 +1217,9 @@ typedef long long longlong;
%typemap(argout) (qstring *errbuf)
{
// %typemap(argout) qstring *errbuf (from: %make_argout_errbuf_raise_when_null_result)
if ( result == NULL )
if ( result == nullptr )
{
if ( $result != NULL )
if ( $result != nullptr )
Py_XDECREF($result);
SWIG_exception_fail(SWIG_RuntimeError, $1->c_str());
}
@@ -1400,7 +1332,7 @@ struct dynamic_wrapped_array_t {
%typemap(check) tinfo_t *
{
// %typemap(check) tinfo_t *
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "$symname" "', argument " "$argnum"" of type '" "$1_type""'");
}
@@ -1433,7 +1365,6 @@ struct dynamic_wrapped_array_t {
%apply (char *STRING, int LENGTH) { (const void *buf, size_t len) };
%apply (char *STRING, int LENGTH) { (const void *value, size_t length) };
%apply (char *STRING, int LENGTH) { (const void *dataptr,size_t len) };
#ifdef PY3
%define %const_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME, STORAGE_TYPE, CONVERTER, LENGTH_GETTER)
%typemap(in) (const PTRTYPE *BUFNAME, size_t SIZENAME) (STORAGE_TYPE tmp)
{
@@ -1455,11 +1386,11 @@ struct dynamic_wrapped_array_t {
{ // %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) (const PTRTYPE *BUFNAME, size_t SIZENAME)
$1 = PyBytes_Check($input) ? 1 : 0;
}
%const_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME, bytevec_t, IDAPyBytes_AsBytes, size)
%const_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME, bytevec_t, PyBytes_as_bytevec_t, size)
%enddef
%define %const_char_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME)
%const_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME, qstring, IDAPyStr_AsUTF8, length)
%const_pointer_and_size(PTRTYPE, BUFNAME, SIZENAME, qstring, PyUnicode_as_qstring, length)
%enddef
%const_void_pointer_and_size(void, buf, size);
@@ -1468,7 +1399,6 @@ struct dynamic_wrapped_array_t {
%const_void_pointer_and_size(void, value, length);
%const_void_pointer_and_size(void, dataptr, len);
%const_char_pointer_and_size(char, value, length);
#endif
// Create wrapper classes for basic type arrays
%array_class(uchar, uchar_array);
@@ -1488,7 +1418,7 @@ SWIGINTERN PyObject *qstrvec2pylist(const qstrvec_t &vec)
size_t n = vec.size();
PyObject *py_list = PyList_New(n);
for ( size_t i=0; i < n; ++i )
PyList_SetItem(py_list, i, IDAPyStr_FromUTF8AndSize(vec[i].c_str(), vec[i].length()));
PyList_SetItem(py_list, i, PyUnicode_FromStringAndSize(vec[i].c_str(), vec[i].length()));
return py_list;
}
%}
@@ -1594,7 +1524,7 @@ SWIGINTERN PyObject *qstrvec2pylist(const qstrvec_t &vec)
/* first, define the typemap */
%typemap(check) (ARGSIG)
{
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(SWIG_ValueError, "invalid null pointer " "in method '" "$symname" "', argument " "$argnum"" of type '" "$1_type""'");
}
/* Then, redeclare prototype. Note that we want this prototype _only_ seen */
@@ -1734,7 +1664,7 @@ SWIGINTERN void __raise_u()
SWIGINTERN void __raise_e(const std::exception &e)
{
const char *what = e.what();
if ( what == NULL || what[0] == '\0' )
if ( what == nullptr || what[0] == '\0' )
{
__raise_u();
}
@@ -1750,8 +1680,8 @@ SWIGINTERN void __raise_e(const std::exception &e)
struct set_interr_throws_t
{
bool was;
set_interr_throws_t() { was = interr_should_throw; interr_should_throw = true; }
~set_interr_throws_t() { interr_should_throw = was; }
set_interr_throws_t() { was = set_interr_throws(true); }
~set_interr_throws_t() { set_interr_throws(was); }
};
SWIGINTERN void __raise_ie(const interr_exc_t &ie)
@@ -1764,25 +1694,25 @@ SWIGINTERN void __raise_ie(const interr_exc_t &ie)
SWIGINTERN void __raise_de(const Swig::DirectorException &e)
{
bool handled = false;
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
{
// Add the new bits of info to the error
PyObject *exception, *v, *tb;
PyErr_Fetch(&exception, &v, &tb);
if ( exception != NULL )
if ( exception != nullptr )
{
PyErr_NormalizeException(&exception, &v, &tb);
if ( exception != NULL )
if ( exception != nullptr )
{
// FIXME: We retrieve the message, but not the context (i.e., the
// stack trace.) Ideally we should perhaps swoop in our own
// 'sys.stderr', call PyErr_Print(), retrieve the result, and
// append that to the new exception message.
newref_t as_str(PyObject_Str(v));
if ( as_str != NULL )
if ( as_str != nullptr )
{
qstring buf;
IDAPyStr_AsUTF8(&buf, as_str.o);
PyUnicode_as_qstring(&buf, as_str.o);
buf.insert(" : ");
buf.insert(e.getMessage());
PyErr_SetString(PyExc_RuntimeError, buf.c_str());
@@ -1865,7 +1795,7 @@ ${NONNULL_TYPEMAPS}
%typemap(directorout) char *get_node_label (qstring tmp)
{
// %typemap(directorout) char *get_node_label (qstring tmp)
if ( IDAPyStr_AsUTF8(&tmp, result) )
if ( PyUnicode_as_qstring(&tmp, result) )
::qstrncpy(iobuf, tmp.c_str(), iobufsize);
else
Swig::DirectorTypeMismatchException::raise(
+13 -23
View File
@@ -61,8 +61,8 @@ ignore_names = [
re.compile("_Swig.*"),
re.compile("_swig.*"),
"SWIG_PyInstanceMethod_New",
"svalvec_t", # aliased with intvec_t or longlongvec_t
"uvalvec_t", # aliased with uintvec_t or ulonglongvec_t
"svalvec_t", # aliased with intvec_t or int64vec_t
"uvalvec_t", # aliased with uintvec_t or uint64vec_t
"eavec_t", # aliased with uvalvec_t
("ida_ida", "__getattr__"),
("idc", "__getattr__"),
@@ -102,7 +102,7 @@ all_specific_translations = {
"ida_hexrays.casm_t" : [
((
"uintvec_t",
"ulonglongvec_t"
"uint64vec_t"
), "eavec_t", True),
((
"unsigned int *",
@@ -126,14 +126,6 @@ all_specific_translations = {
), "qvector< unsigned-ea-like-numeric-type > &", True),
],
"ida_hexrays.ivl_t" : [
((
"uval_ivl_t_off_get(self) -> unsigned int",
"uval_ivl_t_off_get(self) -> unsigned long long",
), "uval_ivl_t_off_get(self) -> unsigned-ea-like-numeric-type", True),
((
"uval_ivl_t_size_get(self) -> unsigned int",
"uval_ivl_t_size_get(self) -> unsigned long long",
), "uval_ivl_t_size_get(self) -> unsigned-ea-like-numeric-type", True),
((
") -> 'unsigned int'",
") -> 'unsigned long long'", # py3
@@ -144,14 +136,6 @@ all_specific_translations = {
), ") -> unsigned-ea-like-numeric-type", True),
],
"ida_hexrays.uval_ivl_t" : [
((
"uval_ivl_t_off_get(self) -> unsigned int",
"uval_ivl_t_off_get(self) -> unsigned long long",
), "uval_ivl_t_off_get(self) -> unsigned-ea-like-numeric-type", True),
((
"uval_ivl_t_size_get(self) -> unsigned int",
"uval_ivl_t_size_get(self) -> unsigned long long",
), "uval_ivl_t_size_get(self) -> unsigned-ea-like-numeric-type", True),
((
") -> 'unsigned int'",
") -> 'unsigned long long'", # py3
@@ -189,11 +173,17 @@ all_specific_translations = {
"v: unsigned long long"
), "v: unsigned-ea-like-numeric-type", True),
],
"ida_nalt.strpath_ids_array" : [
"ida_segment.segment_defsr_array" : [
((
"strpath_ids_array_data_get(self) -> unsigned int",
"strpath_ids_array_data_get(self) -> unsigned long long"
), "strpath_ids_array_data_get(self) -> unsigned-ea-like-numeric-type", True),
"unsigned int const &",
"unsigned long long const &",
), "unsigned-ea-like-numeric-type const &", True),
((
"data: unsigned int (&)",
"data: unsigned long long (&)",
), "data: unsigned-ea-like-numeric-type (&)", True),
],
"ida_nalt.strpath_ids_array" : [
# py3
((
"unsigned int const &",
+1 -6
View File
@@ -1,12 +1,7 @@
from __future__ import print_function
import os, sys, pickle, subprocess
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-l", "--left", required=True)
+6 -16
View File
@@ -38,10 +38,6 @@ def verb(msg):
class ProcessException(Exception):
pass
# --------------------------------------------------------------------------
def python2():
return sys.version_info.major == 2
# --------------------------------------------------------------------------
def read_config():
global config
@@ -899,18 +895,12 @@ class TemplateReplacer(object):
)
def _function_def(self, fun_name, fun_args, fun_body):
if python2():
fun_args = ast.arguments(args=[ast.Name(id=a, ctx=ast.Param()) \
for a in fun_args],
defaults=[])
else:
fun_args = ast.arguments(args=[ast.arg(a, None) \
for a in fun_args],
posonlyargs=[],
kwonlyargs=[],
kw_defaults=[],
defaults=[])
fun_args = ast.arguments(args=[ast.arg(a, None) \
for a in fun_args],
posonlyargs=[],
kwonlyargs=[],
kw_defaults=[],
defaults=[])
return ast.FunctionDef(name=fun_name,
args=fun_args,
body=fun_body,
-66
View File
@@ -266,12 +266,6 @@ ALIASES = "varmem{3} = \link ::\1 \1\endlink.\link \2::\3 \3\end
"v{1} = \verbatim \1 \endverbatim" \
"union{1} = \name \1"
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -1029,13 +1023,6 @@ VERBATIM_HEADERS = YES
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
@@ -1731,16 +1718,6 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
@@ -1805,16 +1782,6 @@ RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@@ -1904,15 +1871,6 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@@ -2107,34 +2065,10 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+2 -2
View File
@@ -186,14 +186,14 @@ def gen_notifications(out):
pass_expr = pname
if deref:
pass_expr = "%s != NULL ? *(%s) : (%s)" % (
pass_expr = "%s != nullptr ? *(%s) : (%s)" % (
pname,
pname,
deref["ifNULL"])
if clinked:
out.write(" ref_t clinked_%s = create_linked_class_instance(%s, %s, %s);\n" %
(pname, clinked["module_define"], clinked["class_define"], pname))
out.write(" if ( clinked_%s == NULL )\n" % pname)
out.write(" if ( clinked_%s == nullptr )\n" % pname)
out.write(" break;\n")
pass_expr = "clinked_%s.o" % pname
elif synth:
+11 -2
View File
@@ -55,14 +55,14 @@ recipe = {
"populating_widget_popup" : {
"params" : {
"ctx" : {
"default" : "NULL",
"default" : "nullptr",
},
},
},
"finish_populating_widget_popup" : {
"params" : {
"ctx" : {
"default" : "NULL",
"default" : "nullptr",
},
},
},
@@ -102,6 +102,15 @@ recipe = {
},
},
},
"database_closed" : {
"params" : {
"reserved" :
{
"suppress_for_call" : True,
"qnotused" : True,
},
},
},
}
default_rtype = "void"
+1 -6
View File
@@ -2,12 +2,7 @@ from __future__ import print_function
import sys
import string
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-i", "--input", required=True)
+2 -6
View File
@@ -4,11 +4,7 @@ import sys
import os
import glob
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-i", "--input", required=True)
@@ -51,7 +47,7 @@ with open(args.input) as fin:
"""
%%typemap(check) (%s %s)
{
if ( $1 == NULL )
if ( $1 == nullptr )
SWIG_exception_fail(SWIG_ValueError, "invalid null pointer " "in method '" "$symname" "', argument " "$argnum"" of type '" "$1_type""'");
}
""" % (ptype, pname))
+1 -6
View File
@@ -2,12 +2,7 @@ from __future__ import print_function
import re
import string
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-i", "--input", required=True)
-61
View File
@@ -1,61 +0,0 @@
#! /bin/bash
# This script will patch IDAPython on OSX so that it works with the homebrew version of Python,
# rather than the System version.
#
# Before running it, please follow these steps:
#
# 1. be sure that you have a 64-bit install of python 2.7 installed by homebrew:
#
# $ brew install python@2
# $ file /usr/local/Cellar/python\@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Python
# /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Python: Mach-O 64-bit dynamically linked shared library x86_64
#
# 2. copy the this script to the root directory of your IDA installation:
#
# $ cp patch-idapython-homebrew.sh /Applications/IDA\ Pro\ 7.1/
#
# and make sure the HOMEBREW_PYTHON variable contains the path to the Python framework installed by homebrew in step 1
#
# 3. $ cd /Applications/IDA\ Pro\ 7.1
# $ ./patch-idapython-homebrew.sh
#
# And that's it! IDAPython commands should still function normally.
HOMEBREW_PYTHON="/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/Python"
IDABIN=ida.app/Contents/MacOS
function backup
{
if [ ! -f ${1}.orig ]; then
cp -r ${1} ${1}.orig
fi
}
PLG=${IDABIN}/plugins/python.dylib
PLG64=${IDABIN}/plugins/python64.dylib
# backup idapython plugin
backup ${PLG}
backup ${PLG64}
DYNLOAD=${IDABIN}/python/lib/python2.7/lib-dynload
# backup python submodules
backup ${DYNLOAD}/ida_32
backup ${DYNLOAD}/ida_64
function patch
{
install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python $HOMEBREW_PYTHON $1
}
# patch idapython plugin
patch ${PLG}
patch ${PLG64}
# patch all of idapython's submodules
for file in $DYNLOAD/ida_{32,64}/*
do
patch $file
done
+4 -9
View File
@@ -5,12 +5,7 @@ import re
import sys
import six
import xml.etree.ElementTree as ET
try:
from argparse import ArgumentParser
except:
print("Failed to import module 'argparse'. Upgrade to Python 2.7, copy argparse.py to this directory or try 'apt-get install python-argparse'")
raise
from argparse import ArgumentParser
parser = ArgumentParser(description='Patch some code generation, so it builds')
parser.add_argument("-i", "--input", required=True)
@@ -210,7 +205,7 @@ with open(args.input) as f:
"printf(\"swig/python detected a memory leak",
(
"#ifdef TESTABLE_BUILD",
" if ( name == NULL || strcmp(name, \"std::out_of_range *\") != 0 )",
" if ( name == nullptr || strcmp(name, \"std::out_of_range *\") != 0 )",
" abort();",
"#endif",
),
@@ -301,10 +296,10 @@ with open(args.input) as f:
elif patch_kind == "thread_unsafe":
if entered_function:
subst = prepend_subst(subst, " if ( !__chkthr() ) return NULL; %s" % patched_cmt, line)
subst = prepend_subst(subst, " if ( !__chkthr() ) return nullptr; %s" % patched_cmt, line)
elif patch_kind == "requires_idb":
if entered_function:
subst = prepend_subst(subst, " if ( !__chkreqidb() ) return NULL; %s" % patched_cmt, line)
subst = prepend_subst(subst, " if ( !__chkreqidb() ) return nullptr; %s" % patched_cmt, line)
elif patch_kind == "director_method_call_arity_cap":
add_gil_lock, method_name, args_cfoa, args_cmoa = patch_data
if entered_function:
+3 -3
View File
@@ -2,13 +2,13 @@
"SwigDirector_dirspec_t::get_name" : [
("repl_text", (
"int swig_res = SWIG_AsVal_bool(result, &swig_val);",
("int swig_res = IDAPyStr_Check(result) && (out == nullptr || IDAPyStr_AsUTF8(out, result));",
("int swig_res = PyUnicode_Check(result) && (out == nullptr || PyUnicode_as_qstring(out, result));",
" swig_val = static_cast<bool>(swig_res);"))),
("director_method_call_arity_cap", (
True, # add GIL lock
"get_name",
"(method ,(PyObject *)obj0,(__argcnt < 2 ? NULL : (PyObject *)obj1), NULL)",
"(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0,(__argcnt < 3 ? NULL : (PyObject *)obj1), NULL)",
"(method ,(PyObject *)obj0,(__argcnt < 2 ? nullptr : (PyObject *)obj1), nullptr)",
"(swig_get_self(), (PyObject *) swig_method_name ,(PyObject *)obj0,(__argcnt < 3 ? nullptr : (PyObject *)obj1), nullptr)",
)),
("spontaneous_callback_call", (
False, # add GIL lock

Some files were not shown because too many files have changed in this diff Show More