Module ida_struct
Structure type management (assembly level types)
Global variables
var MF_BASECLASS
-
a special member representing base class
var MF_BYTIL
-
the member was created due to the type system
var MF_DTOR
-
a special member representing destructor
var MF_DUPNAME
-
duplicate name resolved with _N suffix (N==soff)
var MF_HASTI
-
has type information?
var MF_HASUNI
-
has members of type "union"?
var MF_OK
-
is the member ok? (always yes)
var MF_UNIMEM
-
is a member of a union?
var SET_MEMTI_BYTIL
-
new type was created by the type subsystem
var SET_MEMTI_COMPATIBLE
-
new type must be compatible with the old
var SET_MEMTI_FUNCARG
-
mptr is function argument (cannot create arrays)
var SET_MEMTI_MAY_DESTROY
-
may destroy other members
var SET_MEMTI_USERTI
-
user-specified type
var SF_ALIGN
-
alignment (shift amount: 0..31)
var SF_ASMTIL
-
SF_ASMTIL = -2147483648
var SF_FRAME
-
the structure is a function frame
var SF_GHOST
-
ghost copy of a local type
var SF_HASUNI
-
has members of type "union"?
var SF_HIDDEN
-
the structure is collapsed
var SF_NOLIST
-
don't include in the chooser list
var SF_TYPLIB
-
the structure comes from type library
var SF_UNION
-
is a union? varunions are prohibited!
var SF_VAR
-
is variable size structure (varstruct)? a variable size structure is one with the zero size last member. if the last member is a varstruct, then the current structure is a varstruct too.
var SMT_ARRAY
-
arrays are forbidden as function arguments
var SMT_BADARG
-
bad parameters
var SMT_FAILED
-
failed to set new member type
var SMT_KEEP
-
no need to change the member type, the old type is better
var SMT_NOCOMPAT
-
the new type is not compatible with the old type
var SMT_OK
-
SMT_OK = 1
var SMT_OVERLAP
-
member would overlap with members that cannot be deleted
var SMT_SIZE
-
the new type is incompatible with the member size
var SMT_WORSE
-
the new type is worse than the old type
var STRNFL_REGEX
-
apply regular expressions to beautify the name
var STRUC_ERROR_MEMBER_LTUDT
-
failed to change corresponding local type
var STRUC_ERROR_MEMBER_NAME
-
already has member with this name (bad name)
var STRUC_ERROR_MEMBER_NESTED
-
recursive structure nesting is forbidden
var STRUC_ERROR_MEMBER_OFFSET
-
already has member at this offset
var STRUC_ERROR_MEMBER_OK
-
success
var STRUC_ERROR_MEMBER_SIZE
-
bad number of bytes or bad sizeof(type)
var STRUC_ERROR_MEMBER_STRUCT
-
bad struct id (the 1st argument)
var STRUC_ERROR_MEMBER_TINFO
-
bad typeid parameter
var STRUC_ERROR_MEMBER_UNIVAR
-
unions can't have variable sized members
var STRUC_ERROR_MEMBER_VARLAST
-
variable sized member should be the last member in the structure
var STRUC_SEPARATOR
-
structname.fieldname
Functions
def add_struc(*args) ‑> tid_t
-
add_struc(idx, name, is_union=False) -> tid_tCreate a structure type. if idx==BADADDR then add as the last idx. if name==nullptr then a name will be generated "struct_%d".idx: (C++: uval_t)name: (C++: const char *) char const *is_union: (C++: bool)
def add_struc_member(*args) ‑> struc_error_t
-
add_struc_member(sptr, fieldname, offset, flag, mt, nbytes) -> struc_error_tAdd member to existing structure.sptr: (C++: struc_t *) structure to modifyfieldname: (C++: const char *) if nullptr, then "anonymous_#" name will be generatedoffset: (C++: ea_t) BADADDR means add to the end of structureflag: (C++: flags64_t) type + representation bitsmt: (C++: const opinfo_t *) additional info about member type. must be present for structs,offsets, enums, strings, struct offsets.nbytes: (C++: asize_t) if == 0 then the structure will be a varstruct. in this case themember should be the last member in the structure
def del_member_tinfo(*args) ‑> bool
-
del_member_tinfo(sptr, mptr) -> boolDelete tinfo for given member.sptr: (C++: struc_t *)mptr: (C++: member_t *)
def del_struc(*args) ‑> bool
-
del_struc(sptr) -> boolDelete a structure type This function deletes as well local type synced with the structuresptr: (C++: struc_t *)
def del_struc_member(*args) ‑> bool
-
del_struc_member(sptr, offset) -> boolDelete member at given offset.sptr: (C++: struc_t *)offset: (C++: ea_t)
def del_struc_members(*args) ‑> int
-
del_struc_members(sptr, off1, off2) -> intDelete members which occupy range of offsets (off1..off2).sptr: (C++: struc_t *)off1: (C++: ea_t)off2: (C++: ea_t)return: number of deleted members or -1 on error
def expand_struc(*args) ‑> bool
-
expand_struc(sptr, offset, delta, recalc=True) -> boolExpand/Shrink structure type.sptr: (C++: struc_t *)offset: (C++: ea_t)delta: (C++: adiff_t)recalc: (C++: bool)
def get_best_fit_member(*args) ‑> member_t *
-
get_best_fit_member(sptr, offset) -> member_tGet member that is most likely referenced by the specified offset. Useful for offsets > sizeof(struct).sptr: (C++: const struc_t *) struc_t const *offset: (C++: asize_t)
def get_first_struc_idx(*args) ‑> uval_t
-
get_first_struc_idx() -> uval_tGet index of first structure.return: BADADDR if no known structures, 0 otherwise
def get_innermost_member(*args) ‑> PyObject *
-
get_innermost_member(sptr, offset) -> (member_t, struc_t, int)Get the innermost member at the given offsetsptr: the starting structureoffset: offset into the starting structurereturn: - None on failure
-
tuple(member_t, struct_t, offset)where member_t: a member in SPTR (it is not a structure),struct_t: the innermost structure, offset: remaining offset into the returned member
-
tuple(member_t, struct_t, offset)
def get_last_struc_idx(*args) ‑> uval_t
-
get_last_struc_idx() -> uval_tGet index of last structure.return: BADADDR if no known structures, get_struc_qty()-1 otherwise
def get_max_offset(*args) ‑> ea_t
-
get_max_offset(sptr) -> ea_tFor unions: returns number of members, for structs: returns size of structure.sptr: (C++: struc_t *)
def get_member(*args) ‑> member_t *
-
get_member(sptr, offset) -> member_tGet member at given offset.sptr: (C++: const struc_t *) struc_t const *offset: (C++: asize_t)
def get_member_by_fullname(*args) ‑> struc_t **
-
get_member_by_fullname(fullname) -> member_tGet a member by its fully qualified name, "struct.field".fullname: (C++: const char *) char const *
def get_member_by_id(*args) ‑> qstring *, struc_t **
-
get_member_by_id(mid) -> member_tCheck if the specified member id points to a struct member. convenience function.mid: (C++: tid_t)
def get_member_by_name(*args) ‑> member_t *
-
get_member_by_name(sptr, membername) -> member_tGet a member by its name, like "field44".sptr: (C++: const struc_t *) struc_t const *membername: (C++: const char *) char const *
def get_member_cmt(*args) ‑> qstring *
-
get_member_cmt(mid, repeatable) -> strGet comment of structure member.mid: (C++: tid_t)repeatable: (C++: bool)
def get_member_fullname(*args) ‑> qstring *
-
get_member_fullname(mid) -> strGet a member's fully qualified name, "struct.field".mid: (C++: tid_t)
def get_member_id(*args) ‑> tid_t
-
get_member_id(sptr, offset) -> tid_tGet member id at given offset.sptr: (C++: const struc_t *) struc_t const *offset: (C++: asize_t)
def get_member_name(*args) ‑> qstring *
-
get_member_name(mid) -> strmid: tid_t
def get_member_size(*args) ‑> asize_t
-
get_member_size(NONNULL_mptr) -> asize_tGet size of structure member. May return 0 for the last member of varstruct. For union members, returns member_t::eoff.NONNULL_mptr: (C++: const member_t *) member_t const *
def get_member_struc(*args) ‑> struc_t *
-
get_member_struc(fullname) -> struc_tGet containing structure of member by its full name "struct.field".fullname: (C++: const char *) char const *
def get_member_tinfo(*args) ‑> bool
-
get_member_tinfo(tif, mptr) -> boolGet tinfo for given member.tif: (C++: tinfo_t *)mptr: (C++: const member_t *) member_t const *
def get_next_member_idx(*args) ‑> ssize_t
-
get_next_member_idx(sptr, off) -> ssize_tGet the next member idx, if it does not exist, return -1.sptr: (C++: const struc_t *) struc_t const *off: (C++: asize_t)
def get_next_struc_idx(*args) ‑> uval_t
-
get_next_struc_idx(idx) -> uval_tGet next struct index.idx: (C++: uval_t)return: BADADDR if resulting index is out of bounds, otherwise idx++
def get_or_guess_member_tinfo(*args) ‑> bool
-
get_or_guess_member_tinfo(tif, mptr) -> boolTry to get tinfo for given member - if failed, generate a tinfo using information about the member id from the disassemblytif: (C++: tinfo_t *)mptr: (C++: const member_t *) member_t const *
def get_prev_member_idx(*args) ‑> ssize_t
-
get_prev_member_idx(sptr, off) -> ssize_tGet the prev member idx, if it does not exist, return -1.sptr: (C++: const struc_t *) struc_t const *off: (C++: asize_t)
def get_prev_struc_idx(*args) ‑> uval_t
-
get_prev_struc_idx(idx) -> uval_tGet previous struct index.idx: (C++: uval_t)return: BADADDR if resulting index is negative, otherwise idx - 1
def get_sptr(*args) ‑> struc_t *
-
get_sptr(mptr) -> struc_tGet child struct if member is a struct.mptr: (C++: const member_t *) member_t const *
def get_struc(*args) ‑> struc_t *
-
get_struc(id) -> struc_tGet pointer to struct type info.id: (C++: tid_t)
def get_struc_by_idx(*args) ‑> tid_t
-
get_struc_by_idx(idx) -> tid_tGet struct id by struct number.idx: (C++: uval_t)
def get_struc_cmt(*args) ‑> qstring *
-
get_struc_cmt(id, repeatable) -> strGet struct comment.id: (C++: tid_t)repeatable: (C++: bool)
def get_struc_first_offset(*args) ‑> ea_t
-
get_struc_first_offset(sptr) -> ea_tGet offset of first member.sptr: (C++: const struc_t *) struc_t const *return: BADADDR if memqty == 0
def get_struc_id(*args) ‑> tid_t
-
get_struc_id(name) -> tid_tGet struct id by name.name: (C++: const char *) char const *
def get_struc_idx(*args) ‑> uval_t
-
get_struc_idx(id) -> uval_tGet internal number of the structure.id: (C++: tid_t)
def get_struc_last_offset(*args) ‑> ea_t
-
get_struc_last_offset(sptr) -> ea_tGet offset of last member.sptr: (C++: const struc_t *) struc_t const *return: BADADDR if memqty == 0
def get_struc_name(*args) ‑> qstring *
-
get_struc_name(id, flags=0) -> strid: tid_tflags: int
def get_struc_next_offset(*args) ‑> ea_t
-
get_struc_next_offset(sptr, offset) -> ea_tGet offset of member with smallest offset larger than 'offset'.sptr: (C++: const struc_t *) struc_t const *offset: (C++: ea_t)return: BADADDR if no next offset
def get_struc_prev_offset(*args) ‑> ea_t
-
get_struc_prev_offset(sptr, offset) -> ea_tGet offset of member with largest offset less than 'offset'.sptr: (C++: const struc_t *) struc_t const *offset: (C++: ea_t)return: BADADDR if no prev offset
def get_struc_qty(*args) ‑> size_t
-
get_struc_qty() -> size_tGet number of known structures.
def get_struc_size(*args) ‑> asize_t
-
get_struc_size(sptr) -> asize_tGet struct size (also see get_struc_size(const struc_t *))sptr: struc_t const *get_struc_size(id) -> asize_tid: tid_t
def is_anonymous_member_name(*args) ‑> bool
-
is_anonymous_member_name(name) -> boolIs member name prefixed with "anonymous"?name: (C++: const char *) char const *
def is_dummy_member_name(*args) ‑> bool
-
is_dummy_member_name(name) -> boolIs member name an auto-generated name?name: (C++: const char *) char const *
def is_member_id(*args) ‑> bool
-
is_member_id(mid) -> boolIs a member id?mid: (C++: tid_t)
def is_special_member(*args) ‑> bool
-
is_special_member(id) -> boolIs a special member with the name beginning with ' '?id: (C++: tid_t)
def is_union(*args) ‑> bool
-
is_union(id) -> boolIs a union?id: (C++: tid_t)
def is_varmember(*args) ‑> bool
-
is_varmember(mptr) -> boolIs variable size member?mptr: (C++: const member_t *) member_t const *
def is_varstr(*args) ‑> bool
-
is_varstr(id) -> boolIs variable size structure?id: (C++: tid_t)
def retrieve_member_info(*args) ‑> opinfo_t *
-
retrieve_member_info(buf, mptr) -> opinfo_tGet operand type info for member.buf: (C++: opinfo_t *)mptr: (C++: const member_t *) member_t const *
def save_struc(*args) ‑> void
-
save_struc(sptr, may_update_ltypes=True)Update struct information in the database (internal function)sptr: (C++: const struc_t *) struc_t const *may_update_ltypes: (C++: bool)
def set_member_cmt(*args) ‑> bool
-
set_member_cmt(mptr, cmt, repeatable) -> boolSet member comment.mptr: (C++: member_t *)cmt: (C++: const char *) char const *repeatable: (C++: bool)
def set_member_name(*args) ‑> bool
-
set_member_name(sptr, offset, name) -> boolSet name of member at given offset.sptr: (C++: struc_t *)offset: (C++: ea_t)name: (C++: const char *) char const *
def set_member_tinfo(*args) ‑> smt_code_t
-
set_member_tinfo(sptr, mptr, memoff, tif, flags) -> smt_code_tSet tinfo for given member.sptr: (C++: struc_t *) containing structmptr: (C++: member_t *) target membermemoff: (C++: uval_t) offset within membertif: (C++: const tinfo_t &) type infoflags: (C++: int) Set member tinfo flags
def set_member_type(*args) ‑> bool
-
set_member_type(sptr, offset, flag, mt, nbytes) -> boolSet type of member at given offset (also see add_struc_member())sptr: (C++: struc_t *)offset: (C++: ea_t)flag: (C++: flags64_t)mt: (C++: const opinfo_t *) opinfo_t const *nbytes: (C++: asize_t)
def set_struc_align(*args) ‑> bool
-
set_struc_align(sptr, shift) -> boolSet structure alignment (SF_ALIGN)sptr: (C++: struc_t *)shift: (C++: int)
def set_struc_cmt(*args) ‑> bool
-
set_struc_cmt(id, cmt, repeatable) -> boolSet structure comment.id: (C++: tid_t)cmt: (C++: const char *) char const *repeatable: (C++: bool)
-
set_struc_hidden(sptr, is_hidden)Hide/unhide a struct type.sptr: (C++: struc_t *)is_hidden: (C++: bool)
def set_struc_idx(*args) ‑> bool
-
set_struc_idx(sptr, idx) -> boolSet internal number of struct. Also see get_struc_idx(), get_struc_by_idx().sptr: (C++: const struc_t *) struc_t const *idx: (C++: uval_t)
def set_struc_listed(*args) ‑> void
-
set_struc_listed(sptr, is_listed)Add/remove a struct type from the struct list.sptr: (C++: struc_t *)is_listed: (C++: bool)
def set_struc_name(*args) ‑> bool
-
set_struc_name(id, name) -> boolSet structure name.id: (C++: tid_t)name: (C++: const char *) char const *
def stroff_as_size(*args) ‑> bool
-
stroff_as_size(plen, sptr, value) -> boolplen: intsptr: struc_t const *value: asize_tstroff_as_size(plen, tif, value) -> boolplen: inttif: tinfo_t const &value: asize_t
def unsync_and_delete_struc(*args) ‑> void
-
unsync_and_delete_struc(sptr)Delete the structure but leave synced ltudt unchanged. Note del_struc() deletes both ASM struc and the corresponding local typesptr: (C++: struc_t *)
def visit_stroff_fields(*args) ‑> adiff_t *
-
visit_stroff_fields(sfv, path, disp, appzero) -> flags64_tsfv: struct_field_visitor_t &path: tid_t const *disp: adiff_t *appzero: bool
def visit_stroff_udms(*args) ‑> adiff_t *
-
visit_stroff_udms(sfv, path, disp, appzero) -> intVisit structure fields in a stroff expression or in a reference to a struct data variable. This function can be used to enumerate all components of an expression like 'a.b.c'.sfv: (C++: udm_visitor_t &) visitor objectpath: (C++: const tid_t *) struct path (path[0] contains the initial struct id)disp: (C++: adiff_t *) offset into structureappzero: (C++: bool) should visit field at offset zero?return: visitor result
Classes
class dyn_member_ref_array (*args)
-
Proxy of C++ dynamic_wrapped_array_t< member_t > class.__init__(self, _data, _count) -> dyn_member_ref_array_data: member_t *_count: size_t
Instance variables
var count
-
count
var data
-
data
class member_t (*args)
-
Proxy of C++ member_t class.__init__(self) -> member_t
Instance variables
var eoff
-
end offset
var flag
-
type+representation bits
var id
-
name(), cmt, rptcmt
var props
-
Struct member properties
var soff
-
start offset (for unions - number of the member 0..n)
Methods
def by_til(self, *args) ‑> bool
-
by_til(self) -> boolWas the member created due to the type system?
def get_size(self, *args) ‑> asize_t
-
get_size(self) -> asize_tGet member size.
def get_soff(self, *args) ‑> ea_t
-
get_soff(self) -> ea_tGet start offset (for unions - returns 0)
def has_ti(self, *args) ‑> bool
-
has_ti(self) -> boolHas type information?
def has_union(self, *args) ‑> bool
-
has_union(self) -> boolHas members of type "union"?
def is_baseclass(self, *args) ‑> bool
-
is_baseclass(self) -> boolIs a base class member?
def is_destructor(self, *args) ‑> bool
-
is_destructor(self) -> boolIs a virtual destructor?
def is_dupname(self, *args) ‑> bool
-
is_dupname(self) -> boolDuplicate name was resolved during import?
def unimem(self, *args) ‑> bool
-
unimem(self) -> boolIs a member of a union?
class struc_t (*args, **kwargs)
-
Proxy of C++ struc_t class.
Instance variables
var age
-
not used
var id
-
struct id
var members : dynamic_wrapped_array_t< member_t >
-
only defined members are stored here. there may be gaps between members.
var memqty
-
number of members
var ordinal
-
corresponding local type ordinal number
var props
-
Structure properties
Methods
def from_til(self, *args) ‑> bool
-
from_til(self) -> boolDoes structure come from a type library?
def get_alignment(self, *args) ‑> int
-
get_alignment(self) -> intSee SF_ALIGN.
def get_last_member(self, *args) ‑> member_t const *
-
get_last_member(self) -> member_t
def get_member(self, index)
def has_union(self, *args) ‑> bool
-
has_union(self) -> boolHas members of type "union"?
def is_choosable(self, *args) ‑> bool
-
is_choosable(self) -> boolIs included in chooser list? Use set_struc_listed to change the listed status
def is_copyof(self, *args) ‑> bool
-
is_copyof(self) -> boolIs copied from a local type?
def is_frame(self, *args) ‑> bool
-
is_frame(self) -> boolIs this structure a function frame?
def is_ghost(self, *args) ‑> bool
-
is_ghost(self) -> boolIs a ghost copy of a local type?
-
is_hidden(self) -> boolIs the structure collapsed? Use set_struc_hidden to change the hidden status
def is_mappedto(self, *args) ‑> bool
-
is_mappedto(self) -> boolIs mapped to a local type?
def is_synced(self, *args) ‑> bool
-
is_synced(self) -> boolIs synced with a local type?
def is_union(self, *args) ‑> bool
-
is_union(self) -> boolIs a union?
def is_varstr(self, *args) ‑> bool
-
is_varstr(self) -> boolIs variable size structure?
def like_union(self, *args) ‑> bool
-
like_union(self) -> boolIs a union or contains members of type "union"?
def set_alignment(self, *args) ‑> void
-
set_alignment(self, shift)Do not use; use set_struc_align()shift: (C++: int)
class struct_field_visitor_t (*args)
-
Proxy of C++ struct_field_visitor_t class.__init__(self) -> struct_field_visitor_tself: PyObject *
Methods
def visit_field(self, *args) ‑> int
-
visit_field(self, sptr, mptr) -> intsptr: struc_t *mptr: member_t *
class udm_visitor_t (*args)
-
Proxy of C++ udm_visitor_t class.__init__(self) -> udm_visitor_tself: PyObject *
Methods
def visit_udm(self, *args) ‑> int
-
visit_udm(self, tid, tif, udm) -> inttid: (C++: tid_t) udt tidtif: (C++: const tinfo_t *) udt tif (may be nullptr for corrupted idbs)udm: (C++: const udm_t *) udm to visit (may be nullptr if udm was not found)