Backported fixes

This commit is contained in:
Arnaud Diederen
2020-07-06 09:56:31 +02:00
parent 960d383398
commit 01774be48b
4 changed files with 29 additions and 15 deletions
Binary file not shown.
+5 -4
View File
@@ -16921,7 +16921,8 @@ class Hexrays_Hooks(__builtin__.object)
|
| func_printed(self, *args)
| Function text has been generated. Plugins may modify the text in
| 'cfunc_t::sv' .
| 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' )
| COLOR_ADDR is used to store pointers to ctree elements.
|
| func_printed(self, cfunc) -> int
| @param cfunc (C++: cfunc_t *)
@@ -17102,9 +17103,9 @@ class Hexrays_Hooks(__builtin__.object)
| Decompiled text is ready.
|
| text_ready(self, vu) -> int
| @param vu: This event can be used to modify the output text (sv). The
| text uses regular color codes (see lines.hpp) COLOR_ADDR is
| used to store pointers to ctree elements (C++: vdui_t *)
| @param vu: This event can be used to modify the output text (sv).
| Obsolete. Please use hxe_func_printed instead. (C++:
| vdui_t *)
|
| unhook(self, *args)
| unhook(self) -> bool
+10 -8
View File
@@ -16894,7 +16894,8 @@ class Hexrays_Hooks(builtins.object)
|
| func_printed(self, *args) -> 'int'
| Function text has been generated. Plugins may modify the text in
| 'cfunc_t::sv' .
| 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' )
| COLOR_ADDR is used to store pointers to ctree elements.
|
| func_printed(self, cfunc) -> int
| @param cfunc (C++: cfunc_t *)
@@ -17075,9 +17076,9 @@ class Hexrays_Hooks(builtins.object)
| Decompiled text is ready.
|
| text_ready(self, vu) -> int
| @param vu: This event can be used to modify the output text (sv). The
| text uses regular color codes (see lines.hpp) COLOR_ADDR is
| used to store pointers to ctree elements (C++: vdui_t *)
| @param vu: This event can be used to modify the output text (sv).
| Obsolete. Please use hxe_func_printed instead. (C++:
| vdui_t *)
|
| unhook(self, *args) -> 'bool'
| unhook(self) -> bool
@@ -17139,7 +17140,8 @@ class __cbhooks_t(Hexrays_Hooks)
|
| func_printed(self, *args)
| Function text has been generated. Plugins may modify the text in
| 'cfunc_t::sv' .
| 'cfunc_t::sv' . The text uses regular color codes (see 'lines.hpp' )
| COLOR_ADDR is used to store pointers to ctree elements.
|
| func_printed(self, cfunc) -> int
| @param cfunc (C++: cfunc_t *)
@@ -17215,9 +17217,9 @@ class __cbhooks_t(Hexrays_Hooks)
| Decompiled text is ready.
|
| text_ready(self, vu) -> int
| @param vu: This event can be used to modify the output text (sv). The
| text uses regular color codes (see lines.hpp) COLOR_ADDR is
| used to store pointers to ctree elements (C++: vdui_t *)
| @param vu: This event can be used to modify the output text (sv).
| Obsolete. Please use hxe_func_printed instead. (C++:
| vdui_t *)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
+14 -3
View File
@@ -466,9 +466,20 @@ def IDAPython_ExecScript(script, g, print_error=True):
g[FILE_ATTR] = script
try:
with open(script) as fin:
code = compile(fin.read(), script, 'exec')
exec(code, g)
with open(script, "rb") as fin:
raw = fin.read()
encoding = "UTF-8" # UTF-8 by default: https://www.python.org/dev/peps/pep-3120/
# Look for a 'coding' comment
encoding_pat = re.compile(r'\s*#.*coding[:=]\s*([-\w.]+).*')
for line in raw.decode("ASCII", errors='replace').split("\n"):
match = encoding_pat.match(line)
if match:
encoding = match.group(1)
break
code = compile(raw.decode(encoding), script, 'exec')
exec(code, g)
PY_COMPILE_ERR = None
except Exception as e:
PY_COMPILE_ERR = "%s\n%s" % (str(e), traceback.format_exc())