Backported fixes

This commit is contained in:
Arnaud Diederen
2020-04-21 13:34:35 +02:00
parent 9528950917
commit 0419c3f138
5 changed files with 28 additions and 39 deletions
Binary file not shown.
+12 -26
View File
@@ -79,14 +79,12 @@ def apply_type(ti, ea, tp_name, py_type, py_fields, flags)
*/
static bool py_apply_type(
til_t *ti,
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
ea_t ea,
int flags)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
bool rc;
Py_BEGIN_ALLOW_THREADS;
struc_t *sptr;
@@ -161,14 +159,12 @@ def py_unpack_object_from_idb(ti, tp, fields, ea, pio_flags = 0):
*/
PyObject *py_unpack_object_from_idb(
til_t *ti,
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
ea_t ea,
int pio_flags = 0)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
idc_value_t idc_obj;
error_t err;
Py_BEGIN_ALLOW_THREADS;
@@ -218,13 +214,11 @@ def unpack_object_from_bv(ti, tp, fields, bytes, pio_flags = 0):
*/
PyObject *py_unpack_object_from_bv(
til_t *ti,
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
const bytevec_t &bytes,
int pio_flags = 0)
{
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
idc_value_t idc_obj;
error_t err;
Py_BEGIN_ALLOW_THREADS;
@@ -272,8 +266,8 @@ def pack_object_to_idb(obj, ti, tp, fields, ea, pio_flags = 0):
PyObject *py_pack_object_to_idb(
PyObject *py_obj,
til_t *ti,
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
ea_t ea,
int pio_flags = 0)
{
@@ -285,9 +279,6 @@ PyObject *py_pack_object_to_idb(
if ( !pyvar_to_idcvar_or_error(py_obj_ref, &idc_obj) )
return NULL;
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
// Pack
// error_t err;
error_t err;
@@ -321,8 +312,8 @@ def pack_object_to_bv(obj, ti, tp, fields, base_ea, pio_flags = 0):
PyObject *py_pack_object_to_bv(
PyObject *py_obj,
til_t *ti,
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
ea_t base_ea,
int pio_flags=0)
{
@@ -334,9 +325,6 @@ PyObject *py_pack_object_to_bv(
if ( !pyvar_to_idcvar_or_error(py_obj_ref, &idc_obj) )
return NULL;
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
// Pack
relobj_t bytes;
error_t err;
@@ -484,15 +472,13 @@ int idc_get_local_type(int ordinal, int flags, char *buf, size_t maxsize)
//-------------------------------------------------------------------------
PyObject *idc_print_type(
const bytevec_t &_type,
const bytevec_t &_fields,
const type_t *type,
const p_list *fields,
const char *name,
int flags)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qstring res;
const type_t *type = (const type_t *) _type.begin();
const p_list *fields = (const p_list *) _fields.begin();
bool ok;
Py_BEGIN_ALLOW_THREADS;
tinfo_t tif;
+6 -6
View File
@@ -64483,7 +64483,7 @@ apply_tinfo_to_stkarg(*args)
Help on function apply_type in module ida_typeinf:
apply_type(*args)
apply_type(ti, _type, _fields, ea, flags) -> bool
apply_type(ti, type, fields, ea, flags) -> bool
Apply the specified type to the address
@@ -66745,7 +66745,7 @@ idc_parse_types(*args)
Help on function idc_print_type in module ida_typeinf:
idc_print_type(*args)
idc_print_type(_type, _fields, name, flags) -> PyObject *
idc_print_type(type, fields, name, flags) -> PyObject *
Help on function idc_set_local_type in module ida_typeinf:
@@ -67548,7 +67548,7 @@ pack_idcobj_to_idb(*args)
Help on function pack_object_to_bv in module ida_typeinf:
pack_object_to_bv(*args)
pack_object_to_bv(py_obj, ti, _type, _fields, base_ea, pio_flags=0) -> PyObject *
pack_object_to_bv(py_obj, ti, type, fields, base_ea, pio_flags=0) -> PyObject *
Packs a typed object to a string
@@ -67564,7 +67564,7 @@ pack_object_to_bv(*args)
Help on function pack_object_to_idb in module ida_typeinf:
pack_object_to_idb(*args)
pack_object_to_idb(py_obj, ti, _type, _fields, ea, pio_flags=0) -> PyObject *
pack_object_to_idb(py_obj, ti, type, fields, ea, pio_flags=0) -> PyObject *
Write a typed object to the database.
@@ -70089,7 +70089,7 @@ unpack_idcobj_from_idb(*args)
Help on function unpack_object_from_bv in module ida_typeinf:
unpack_object_from_bv(*args)
unpack_object_from_bv(ti, _type, _fields, bytes, pio_flags=0) -> PyObject *
unpack_object_from_bv(ti, type, fields, bytes, pio_flags=0) -> PyObject *
Unpacks a buffer into an object.
@@ -70106,7 +70106,7 @@ unpack_object_from_bv(*args)
Help on function unpack_object_from_idb in module ida_typeinf:
unpack_object_from_idb(*args)
unpack_object_from_idb(ti, _type, _fields, ea, pio_flags=0) -> PyObject *
unpack_object_from_idb(ti, type, fields, ea, pio_flags=0) -> PyObject *
Help on class valstr_t in module ida_typeinf:
+6 -6
View File
@@ -64560,7 +64560,7 @@ apply_tinfo_to_stkarg(*args) -> 'bool'
Help on function apply_type in module ida_typeinf:
apply_type(*args) -> 'bool'
apply_type(ti, _type, _fields, ea, flags) -> bool
apply_type(ti, type, fields, ea, flags) -> bool
Apply the specified type to the address
@@ -66830,7 +66830,7 @@ idc_parse_types(*args) -> 'int'
Help on function idc_print_type in module ida_typeinf:
idc_print_type(*args) -> 'PyObject *'
idc_print_type(_type, _fields, name, flags) -> PyObject *
idc_print_type(type, fields, name, flags) -> PyObject *
Help on function idc_set_local_type in module ida_typeinf:
@@ -67631,7 +67631,7 @@ pack_idcobj_to_idb(*args) -> 'error_t'
Help on function pack_object_to_bv in module ida_typeinf:
pack_object_to_bv(*args) -> 'PyObject *'
pack_object_to_bv(py_obj, ti, _type, _fields, base_ea, pio_flags=0) -> PyObject *
pack_object_to_bv(py_obj, ti, type, fields, base_ea, pio_flags=0) -> PyObject *
Packs a typed object to a string
@@ -67647,7 +67647,7 @@ pack_object_to_bv(*args) -> 'PyObject *'
Help on function pack_object_to_idb in module ida_typeinf:
pack_object_to_idb(*args) -> 'PyObject *'
pack_object_to_idb(py_obj, ti, _type, _fields, ea, pio_flags=0) -> PyObject *
pack_object_to_idb(py_obj, ti, type, fields, ea, pio_flags=0) -> PyObject *
Write a typed object to the database.
@@ -70144,7 +70144,7 @@ unpack_idcobj_from_idb(*args) -> 'error_t'
Help on function unpack_object_from_bv in module ida_typeinf:
unpack_object_from_bv(*args) -> 'PyObject *'
unpack_object_from_bv(ti, _type, _fields, bytes, pio_flags=0) -> PyObject *
unpack_object_from_bv(ti, type, fields, bytes, pio_flags=0) -> PyObject *
Unpacks a buffer into an object.
@@ -70161,7 +70161,7 @@ unpack_object_from_bv(*args) -> 'PyObject *'
Help on function unpack_object_from_idb in module ida_typeinf:
unpack_object_from_idb(*args) -> 'PyObject *'
unpack_object_from_idb(ti, _type, _fields, ea, pio_flags=0) -> PyObject *
unpack_object_from_idb(ti, type, fields, ea, pio_flags=0) -> PyObject *
Help on class valstr_t in module ida_typeinf:
+4 -1
View File
@@ -56,7 +56,10 @@
// Add a get_member() member function to struc_t.
// This helps to access the members array in the class.
%extend struc_t {
member_t *get_member(int index) { return &(self->members[index]); }
member_t *get_member(uint32 index)
{
return index < $self->memqty ? &$self->members[index] : nullptr;
}
}
%inline %{