diff --git a/api_contents2.txt b/api_contents2.txt index 9b00e35..3d9bae3 100644 --- a/api_contents2.txt +++ b/api_contents2.txt @@ -11379,6 +11379,7 @@ 'uchar_array_cast', 'uchar_array_frompointer', 'udc_filter_t_apply', + 'udc_filter_t_cleanup', 'udc_filter_t_init', 'udc_filter_t_install', 'udc_filter_t_match', diff --git a/api_contents3.txt b/api_contents3.txt index b3ec3c3..4f64157 100644 --- a/api_contents3.txt +++ b/api_contents3.txt @@ -11374,6 +11374,7 @@ 'uchar_array_cast', 'uchar_array_frompointer', 'udc_filter_t_apply', + 'udc_filter_t_cleanup', 'udc_filter_t_init', 'udc_filter_t_install', 'udc_filter_t_match', diff --git a/out_of_tree/parsed_notifications.zip b/out_of_tree/parsed_notifications.zip index e1c02f1..ee54bd7 100644 Binary files a/out_of_tree/parsed_notifications.zip and b/out_of_tree/parsed_notifications.zip differ diff --git a/python/init.py b/python/init.py index 6cd5b75..63b78e5 100644 --- a/python/init.py +++ b/python/init.py @@ -57,6 +57,8 @@ class IDAPythonStdOut: """ Dummy file-like class that receives stout and stderr """ + encoding = "UTF-8" + def write(self, text): # NB: in case 'text' is Unicode, msg() will decode it # and call msg() to print it diff --git a/pywraps/py_hexrays.hpp b/pywraps/py_hexrays.hpp index 5e65589..4f2efa8 100644 --- a/pywraps/py_hexrays.hpp +++ b/pywraps/py_hexrays.hpp @@ -251,7 +251,11 @@ void hexrays_unloading__clear_python_clearable_references(void) ((valrng_t *) hxc.ptr)->set_none(); break; case hxclr_udc_filter_t: - install_microcode_filter((microcode_filter_t *) hxc.ptr, false); + { + udc_filter_t *uf = (udc_filter_t *) hxc.ptr; + install_microcode_filter(uf, false); + uf->cleanup(); + } break; default: INTERR(30499); } diff --git a/release_api_contents2.txt b/release_api_contents2.txt index 824493d..5a6a13b 100644 --- a/release_api_contents2.txt +++ b/release_api_contents2.txt @@ -10715,6 +10715,7 @@ 'uchar_array_cast', 'uchar_array_frompointer', 'udc_filter_t_apply', + 'udc_filter_t_cleanup', 'udc_filter_t_init', 'udc_filter_t_install', 'udc_filter_t_match', diff --git a/release_api_contents3.txt b/release_api_contents3.txt index e72f126..5e52274 100644 --- a/release_api_contents3.txt +++ b/release_api_contents3.txt @@ -10719,6 +10719,7 @@ 'uchar_array_cast', 'uchar_array_frompointer', 'udc_filter_t_apply', + 'udc_filter_t_cleanup', 'udc_filter_t_init', 'udc_filter_t_install', 'udc_filter_t_match', diff --git a/release_pydoc_injections2.txt b/release_pydoc_injections2.txt index 7d0727b..6f31aea 100644 --- a/release_pydoc_injections2.txt +++ b/release_pydoc_injections2.txt @@ -36690,6 +36690,10 @@ class udc_filter_t(microcode_filter_t) | the next instruction MERR_INSN - not generated - the caller | should try the standard way else - error | + | cleanup(self, *args) + | Cleanup the filter This function properly clears type information + | associated to this filter. + | | init(self, *args) | init(self, decl) -> bool | @param decl (C++: const char *) diff --git a/release_pydoc_injections3.txt b/release_pydoc_injections3.txt index f2c8d9c..edd7234 100644 --- a/release_pydoc_injections3.txt +++ b/release_pydoc_injections3.txt @@ -36745,6 +36745,10 @@ class udc_filter_t(microcode_filter_t) | the next instruction MERR_INSN - not generated - the caller | should try the standard way else - error | + | cleanup(self, *args) -> 'void' + | Cleanup the filter This function properly clears type information + | associated to this filter. + | | init(self, *args) -> 'bool' | init(self, decl) -> bool | @param decl (C++: const char *) diff --git a/swig/hexrays.i b/swig/hexrays.i index bb2982d..9c9704b 100644 --- a/swig/hexrays.i +++ b/swig/hexrays.i @@ -283,6 +283,20 @@ SWIGINTERN void __raise_vdf(const vd_failure_t &e) %def_opt_handler(optblock_t, install_optblock_handler, remove_optblock_handler, hxclr_optblock_t) %def_opt_handler(udc_filter_t, install_udc_filter, remove_udc_filter, hxclr_udc_filter_t) +// udc_filter_t::init() will create a tinfo_t from the user-provided +// declaration. We must also ensure the instance is registered +// even if only init() is called (but install() isn't) +%extend udc_filter_t { + bool init(const char *decl) + { + const bool ok = $self->init(decl); + if ( ok ) + hexrays_register_python_clearable_instance($self, hxclr_udc_filter_t); + return ok; + } +}; + + // "Warning 473: Returning a pointer or reference in a director method is not recommended." %warnfilter(473) codegen_t::emit_micro_mvm;