Types
types
Classes:
-
ArrayDetails– -
BitfieldAttr–Bitfield Type flags
-
BitfieldDetails–Bitfield type details
-
CallingConvention–Calling convention for function types.
-
EnumAttr–Enum Type flags
-
EnumBuilder–Builder for creating enum types.
-
EnumDetails–Enum type details.
-
EnumMemberInfo–Details about an enum member.
-
FuncArgumentInfo–Details about a function argument.
-
FuncAttr–Function Type flags
-
FuncDetails–Function type details.
-
FuncTypeBuilder–Builder for creating function types.
-
LibraryAddFlags–Flags for changing the way type libraries are added to the database
-
LibraryAddResult–Return values for library add operation
-
NotSupportedWarning–Warning for unsupported features in the underlying idapython API
-
PtrAttr–Pointer Type Flags
-
PtrDetails– -
StructBuilder–Builder for creating struct types.
-
TypeApplyFlags–Flags that control how type information is applied to a given address
-
TypeAttr–General Type attributes
-
TypeDetails–Comprehensive type information with category-specific attributes
-
TypeDetailsVisitor–Visitor class for types.
-
TypeFormattingFlags–Type formatting flags used to control type parsing, formatting and printing
-
TypeKind–Type category enumeration.
-
TypeManipulationFlags–Flags to be used
-
TypeMemberLookupMode–Mode for member lookup operations.
-
Types–Provides access to type information and manipulation in the IDA database.
-
UdtAttr–User Defined Type flags
-
UdtDetails–User Defined Type details
-
UdtMemberInfo–Details about a struct/union member.
-
UnionBuilder–Builder for creating union types.
ArrayDetails
ArrayDetails()
Methods:
-
from_tinfo_t–Extract array type attributes and details.
Attributes:
-
base(int) –Get array base.
-
element_type(tinfo_t) –Get array element type.
-
length(int) –Get number of elements.
base
property
base: int
Get array base.
element_type
property
element_type: tinfo_t
Get array element type.
length
property
length: int
Get number of elements.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[ArrayDetails]
Extract array type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Array type details object filled with extracted information.
BitfieldAttr
BitfieldDetails
BitfieldDetails()
Bitfield type details
Methods:
-
from_tinfo_t–Extract bitfield type attributes and details.
Attributes:
-
attributes(Optional[BitfieldAttr]) –Get the bitfield type attributes.
from_tinfo_t
classmethod
from_tinfo_t(
type_info: tinfo_t,
) -> Optional[BitfieldDetails]
Extract bitfield type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Bitfield type details object filled with extracted information.
CallingConvention
Bases: Enum
Calling convention for function types.
Attributes:
CDECL
class-attribute
instance-attribute
CDECL = 'cdecl'
DEFAULT
class-attribute
instance-attribute
DEFAULT = 'default'
FASTCALL
class-attribute
instance-attribute
FASTCALL = 'fastcall'
STDCALL
class-attribute
instance-attribute
STDCALL = 'stdcall'
THISCALL
class-attribute
instance-attribute
THISCALL = 'thiscall'
EnumAttr
Bases: Flag
Enum Type flags
Attributes:
-
BINARY– -
BITMASK– -
CHAR– -
DECIMAL– -
HEXADECIMAL– -
LEADING_ZEROS– -
OCTAL– -
SIGNED– -
SIGNED_BINARY– -
SIGNED_HEXADECIMAL– -
SIGNED_OCTAL– -
UNSIGNED_DECIMAL–
BINARY
class-attribute
instance-attribute
BINARY = auto()
BITMASK
class-attribute
instance-attribute
BITMASK = auto()
CHAR
class-attribute
instance-attribute
CHAR = auto()
DECIMAL
class-attribute
instance-attribute
DECIMAL = auto()
HEXADECIMAL
class-attribute
instance-attribute
HEXADECIMAL = auto()
LEADING_ZEROS
class-attribute
instance-attribute
LEADING_ZEROS = auto()
OCTAL
class-attribute
instance-attribute
OCTAL = auto()
SIGNED
class-attribute
instance-attribute
SIGNED = auto()
SIGNED_BINARY
class-attribute
instance-attribute
SIGNED_BINARY = auto()
SIGNED_HEXADECIMAL
class-attribute
instance-attribute
SIGNED_HEXADECIMAL = auto()
SIGNED_OCTAL
class-attribute
instance-attribute
SIGNED_OCTAL = auto()
UNSIGNED_DECIMAL
class-attribute
instance-attribute
UNSIGNED_DECIMAL = auto()
EnumBuilder
EnumBuilder(name: str, base_size: int = 4)
Builder for creating enum types.
Example: >>> builder = db.types.create_enum("FileMode", base_size=4) >>> builder.add_member("READ", 1) >>> builder.add_member("WRITE", 2) >>> builder.add_member("EXEC", 4) >>> file_mode = builder.build()
Initialize an enum builder.
Args: name: Name for the enum type. base_size: Size in bytes (1, 2, 4, or 8).
Methods:
-
add_member–Add a member to the enum.
-
build–Build and return the enum type.
-
build_and_save–Build the enum and save it to a type library.
-
set_bitmask–Set whether this is a bitmask enum.
add_member
add_member(name: str, value: int) -> 'EnumBuilder'
Add a member to the enum.
Args: name: Member name. value: Numeric value.
Returns: Self for method chaining.
build
build() -> tinfo_t
Build and return the enum type.
Returns: The constructed tinfo_t.
Raises: RuntimeError: If enum creation fails.
build_and_save
build_and_save(library: Optional[til_t] = None) -> tinfo_t
Build the enum and save it to a type library.
Args: library: Target library (local library if None).
Returns: The constructed and saved tinfo_t.
set_bitmask
set_bitmask(is_bitmask: bool = True) -> 'EnumBuilder'
Set whether this is a bitmask enum.
EnumDetails
EnumDetails()
Enum type details.
Methods:
-
from_tinfo_t–Extract enum type attributes and details.
Attributes:
-
attributes(Optional[EnumAttr]) –Get enum type attributes
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[EnumDetails]
Extract enum type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Enum type details object filled with extracted information.
EnumMemberInfo
dataclass
EnumMemberInfo(name: str, value: int)
FuncArgumentInfo
dataclass
FuncArgumentInfo(index: int, name: str, type: tinfo_t)
Details about a function argument.
Attributes:
-
index(int) –Argument index (0-based).
-
name(str) –Argument name (may be empty/auto-generated).
-
type(tinfo_t) –Argument type information.
index
instance-attribute
index: int
Argument index (0-based).
name
instance-attribute
name: str
Argument name (may be empty/auto-generated).
type
instance-attribute
type: tinfo_t
Argument type information.
FuncAttr
Bases: Flag
Function Type flags
Attributes:
-
CONST– -
CONSTRUCTOR– -
DESTRUCTOR– -
GOLANG_CC– -
HIGH_LEVEL– -
NO_RET– -
PURE– -
STATIC– -
SWIFT_CC– -
USER_CC– -
VARARG_CC– -
VIRTUAL–
CONST
class-attribute
instance-attribute
CONST = auto()
CONSTRUCTOR
class-attribute
instance-attribute
CONSTRUCTOR = auto()
DESTRUCTOR
class-attribute
instance-attribute
DESTRUCTOR = auto()
GOLANG_CC
class-attribute
instance-attribute
GOLANG_CC = auto()
HIGH_LEVEL
class-attribute
instance-attribute
HIGH_LEVEL = auto()
NO_RET
class-attribute
instance-attribute
NO_RET = auto()
PURE
class-attribute
instance-attribute
PURE = auto()
STATIC
class-attribute
instance-attribute
STATIC = auto()
SWIFT_CC
class-attribute
instance-attribute
SWIFT_CC = auto()
USER_CC
class-attribute
instance-attribute
USER_CC = auto()
VARARG_CC
class-attribute
instance-attribute
VARARG_CC = auto()
VIRTUAL
class-attribute
instance-attribute
VIRTUAL = auto()
FuncDetails
FuncDetails()
Function type details.
Methods:
-
from_tinfo_t–Extract function type attributes and details.
Attributes:
-
attributes(Optional[FuncAttr]) –Get the function type attributes.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[FuncDetails]
Extract function type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Function type details object filled with extracted information.
FuncTypeBuilder
FuncTypeBuilder()
Builder for creating function types.
Example: >>> builder = db.types.create_func_type() >>> builder.set_return_type(db.types.create_primitive(4)) >>> builder.add_argument("count", db.types.create_primitive(4)) >>> builder.add_argument("buffer", db.types.create_pointer(db.types.create_primitive(1))) >>> func_type = builder.build()
Initialize a function type builder.
Methods:
-
add_argument–Add an argument to the function type.
-
build–Build and return the function type.
-
set_calling_convention–Set the calling convention.
-
set_return_type–Set the return type.
-
set_variadic–Set whether function accepts variable arguments.
add_argument
add_argument(
name: str, arg_type: tinfo_t
) -> 'FuncTypeBuilder'
Add an argument to the function type.
Args: name: Argument name. arg_type: Argument type.
Returns: Self for method chaining.
build
build() -> tinfo_t
Build and return the function type.
Returns: The constructed tinfo_t.
Raises: RuntimeError: If function type creation fails.
set_calling_convention
set_calling_convention(
cc: CallingConvention,
) -> 'FuncTypeBuilder'
Set the calling convention.
Args: cc: Calling convention enum value.
Returns: Self for method chaining.
set_return_type
set_return_type(ret_type: tinfo_t) -> 'FuncTypeBuilder'
Set the return type.
Args: ret_type: Return type (void if not set).
Returns: Self for method chaining.
set_variadic
set_variadic(variadic: bool = True) -> 'FuncTypeBuilder'
Set whether function accepts variable arguments.
Returns: Self for method chaining.
LibraryAddFlags
Bases: IntFlag
Flags for changing the way type libraries are added to the database
Attributes:
-
ADD_DEFAULT–Default behavior
-
ADD_INCOMPATIBLE–Add incompatible type libraries
-
ADD_SILENT–Do not ask any questions
ADD_DEFAULT
class-attribute
instance-attribute
ADD_DEFAULT = ADDTIL_DEFAULT
Default behavior
ADD_INCOMPATIBLE
class-attribute
instance-attribute
ADD_INCOMPATIBLE = ADDTIL_INCOMP
Add incompatible type libraries
ADD_SILENT
class-attribute
instance-attribute
ADD_SILENT = ADDTIL_SILENT
Do not ask any questions
LibraryAddResult
Bases: IntEnum
Return values for library add operation
Attributes:
-
ABORTED–Library not loaded, rejected by the user
-
FAILED–Loading library failed
-
INCOMPATIBLE–Library loaded but is incompatible
-
SUCCESS–Library successfully loaded
ABORTED
class-attribute
instance-attribute
ABORTED = ADDTIL_ABORTED
Library not loaded, rejected by the user
FAILED
class-attribute
instance-attribute
FAILED = ADDTIL_FAILED
Loading library failed
INCOMPATIBLE
class-attribute
instance-attribute
INCOMPATIBLE = ADDTIL_COMP
Library loaded but is incompatible
SUCCESS
class-attribute
instance-attribute
SUCCESS = ADDTIL_OK
Library successfully loaded
NotSupportedWarning
Bases: Warning
Warning for unsupported features in the underlying idapython API
PtrAttr
Bases: Flag
Pointer Type Flags
Attributes:
-
CODE_POINTER– -
SHIFTED–
CODE_POINTER
class-attribute
instance-attribute
CODE_POINTER = auto()
SHIFTED
class-attribute
instance-attribute
SHIFTED = auto()
PtrDetails
PtrDetails()
Methods:
-
from_tinfo_t–Extract pointer type attributes and details.
Attributes:
-
attributes(Optional[PtrAttr]) –Get pointer type attributes.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[PtrDetails]
Extract pointer type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Pointer type details object filled with extracted information.
StructBuilder
StructBuilder(name: str)
Builder for creating struct types.
Example: >>> builder = db.types.create_struct("MyStruct") >>> builder.add_member("x", db.types.create_primitive(4)) >>> builder.add_member("y", db.types.create_primitive(4)) >>> my_struct = builder.build()
Initialize a struct builder.
Args: name: Name for the struct type.
Methods:
-
add_member–Add a member to the struct.
-
build–Build and return the struct type.
-
build_and_save–Build the struct and save it to a type library.
-
set_alignment–Set explicit alignment for the struct.
-
set_packed–Set whether the struct is packed (no padding).
add_member
add_member(
name: str,
member_type: tinfo_t,
offset: Optional[int] = None,
) -> 'StructBuilder'
Add a member to the struct.
Args: name: Member name. member_type: Member type. offset: Explicit byte offset (auto-calculated if None).
Returns: Self for method chaining.
build
build() -> tinfo_t
Build and return the struct type.
Returns: The constructed tinfo_t.
Raises: RuntimeError: If struct creation fails.
build_and_save
build_and_save(library: Optional[til_t] = None) -> tinfo_t
Build the struct and save it to a type library.
Args: library: Target library (local library if None).
Returns: The constructed and saved tinfo_t.
set_alignment
set_alignment(alignment: int) -> 'StructBuilder'
Set explicit alignment for the struct.
set_packed
set_packed(packed: bool = True) -> 'StructBuilder'
Set whether the struct is packed (no padding).
TypeApplyFlags
Bases: IntFlag
Flags that control how type information is applied to a given address
Attributes:
DEFINITE
class-attribute
instance-attribute
DEFINITE = TINFO_DEFINITE
DELAYFUNC
class-attribute
instance-attribute
DELAYFUNC = TINFO_DELAYFUNC
GUESSED
class-attribute
instance-attribute
GUESSED = TINFO_GUESSED
STRICT
class-attribute
instance-attribute
STRICT = TINFO_STRICT
TypeAttr
Bases: Flag
General Type attributes
Attributes:
-
ARITHMETIC– -
ARRAY– -
ATTACHED– -
BITFIELD– -
BOOL– -
CHAR– -
COMPLEX– -
CONST– -
CORRECT– -
DECL_ARRAY– -
DECL_BITFIELD– -
DECL_BOOL– -
DECL_CHAR– -
DECL_COMPLEX– -
DECL_CONST– -
DECL_DOUBLE– -
DECL_ENUM– -
DECL_FLOAT– -
DECL_FLOATING– -
DECL_FUNC– -
DECL_INT– -
DECL_INT128– -
DECL_INT16– -
DECL_INT32– -
DECL_INT64– -
DECL_LAST– -
DECL_LDOUBLE– -
DECL_PAF– -
DECL_PARTIAL– -
DECL_PTR– -
DECL_STRUCT– -
DECL_SUE– -
DECL_TBYTE– -
DECL_TYPEDEF– -
DECL_UCHAR– -
DECL_UDT– -
DECL_UINT– -
DECL_UINT128– -
DECL_UINT16– -
DECL_UINT32– -
DECL_UINT64– -
DECL_UNION– -
DECL_UNKNOWN– -
DECL_VOID– -
DECL_VOLATILE– -
DOUBLE– -
ENUM– -
EXT_ARITHMETIC– -
EXT_INTEGRAL– -
FLOAT– -
FLOATING– -
FUNC– -
FUNC_PTR– -
HIGH_LEVEL_FUNC– -
INT– -
INT128– -
INT16– -
INT32– -
INT64– -
INTEGRAL– -
LDOUBLE– -
PAF– -
PARTIAL– -
POINTER_UNKNOWN– -
POINTER_VOID– -
PTR– -
PTR_OR_ARRAY– -
PURGING_CALLING_CONVENTION– -
SCALAR– -
SHIFTED_PTR– -
STRUCT– -
SUE– -
TBYTE– -
UCHAR– -
UDT– -
UINT– -
UINT128– -
UINT16– -
UINT32– -
UINT64– -
UNION– -
UNKNOWN– -
USER_CALLING_CONVENTION– -
VARARG_CALLING_CONVENTION– -
VARIABLE_STRUCT– -
VARIABLE_STRUCT_MEMBER– -
VOID– -
VOLATILE– -
WELL_DEFINED–
ARITHMETIC
class-attribute
instance-attribute
ARITHMETIC = auto()
ARRAY
class-attribute
instance-attribute
ARRAY = auto()
ATTACHED
class-attribute
instance-attribute
ATTACHED = auto()
BITFIELD
class-attribute
instance-attribute
BITFIELD = auto()
BOOL
class-attribute
instance-attribute
BOOL = auto()
CHAR
class-attribute
instance-attribute
CHAR = auto()
COMPLEX
class-attribute
instance-attribute
COMPLEX = auto()
CONST
class-attribute
instance-attribute
CONST = auto()
CORRECT
class-attribute
instance-attribute
CORRECT = auto()
DECL_ARRAY
class-attribute
instance-attribute
DECL_ARRAY = auto()
DECL_BITFIELD
class-attribute
instance-attribute
DECL_BITFIELD = auto()
DECL_BOOL
class-attribute
instance-attribute
DECL_BOOL = auto()
DECL_CHAR
class-attribute
instance-attribute
DECL_CHAR = auto()
DECL_COMPLEX
class-attribute
instance-attribute
DECL_COMPLEX = auto()
DECL_CONST
class-attribute
instance-attribute
DECL_CONST = auto()
DECL_DOUBLE
class-attribute
instance-attribute
DECL_DOUBLE = auto()
DECL_ENUM
class-attribute
instance-attribute
DECL_ENUM = auto()
DECL_FLOAT
class-attribute
instance-attribute
DECL_FLOAT = auto()
DECL_FLOATING
class-attribute
instance-attribute
DECL_FLOATING = auto()
DECL_FUNC
class-attribute
instance-attribute
DECL_FUNC = auto()
DECL_INT
class-attribute
instance-attribute
DECL_INT = auto()
DECL_INT128
class-attribute
instance-attribute
DECL_INT128 = auto()
DECL_INT16
class-attribute
instance-attribute
DECL_INT16 = auto()
DECL_INT32
class-attribute
instance-attribute
DECL_INT32 = auto()
DECL_INT64
class-attribute
instance-attribute
DECL_INT64 = auto()
DECL_LAST
class-attribute
instance-attribute
DECL_LAST = auto()
DECL_LDOUBLE
class-attribute
instance-attribute
DECL_LDOUBLE = auto()
DECL_PAF
class-attribute
instance-attribute
DECL_PAF = auto()
DECL_PARTIAL
class-attribute
instance-attribute
DECL_PARTIAL = auto()
DECL_PTR
class-attribute
instance-attribute
DECL_PTR = auto()
DECL_STRUCT
class-attribute
instance-attribute
DECL_STRUCT = auto()
DECL_SUE
class-attribute
instance-attribute
DECL_SUE = auto()
DECL_TBYTE
class-attribute
instance-attribute
DECL_TBYTE = auto()
DECL_TYPEDEF
class-attribute
instance-attribute
DECL_TYPEDEF = auto()
DECL_UCHAR
class-attribute
instance-attribute
DECL_UCHAR = auto()
DECL_UDT
class-attribute
instance-attribute
DECL_UDT = auto()
DECL_UINT
class-attribute
instance-attribute
DECL_UINT = auto()
DECL_UINT128
class-attribute
instance-attribute
DECL_UINT128 = auto()
DECL_UINT16
class-attribute
instance-attribute
DECL_UINT16 = auto()
DECL_UINT32
class-attribute
instance-attribute
DECL_UINT32 = auto()
DECL_UINT64
class-attribute
instance-attribute
DECL_UINT64 = auto()
DECL_UNION
class-attribute
instance-attribute
DECL_UNION = auto()
DECL_UNKNOWN
class-attribute
instance-attribute
DECL_UNKNOWN = auto()
DECL_VOID
class-attribute
instance-attribute
DECL_VOID = auto()
DECL_VOLATILE
class-attribute
instance-attribute
DECL_VOLATILE = auto()
DOUBLE
class-attribute
instance-attribute
DOUBLE = auto()
ENUM
class-attribute
instance-attribute
ENUM = auto()
EXT_ARITHMETIC
class-attribute
instance-attribute
EXT_ARITHMETIC = auto()
EXT_INTEGRAL
class-attribute
instance-attribute
EXT_INTEGRAL = auto()
FLOAT
class-attribute
instance-attribute
FLOAT = auto()
FLOATING
class-attribute
instance-attribute
FLOATING = auto()
FUNC
class-attribute
instance-attribute
FUNC = auto()
FUNC_PTR
class-attribute
instance-attribute
FUNC_PTR = auto()
HIGH_LEVEL_FUNC
class-attribute
instance-attribute
HIGH_LEVEL_FUNC = auto()
INT
class-attribute
instance-attribute
INT = auto()
INT128
class-attribute
instance-attribute
INT128 = auto()
INT16
class-attribute
instance-attribute
INT16 = auto()
INT32
class-attribute
instance-attribute
INT32 = auto()
INT64
class-attribute
instance-attribute
INT64 = auto()
INTEGRAL
class-attribute
instance-attribute
INTEGRAL = auto()
LDOUBLE
class-attribute
instance-attribute
LDOUBLE = auto()
PAF
class-attribute
instance-attribute
PAF = auto()
PARTIAL
class-attribute
instance-attribute
PARTIAL = auto()
POINTER_UNKNOWN
class-attribute
instance-attribute
POINTER_UNKNOWN = auto()
POINTER_VOID
class-attribute
instance-attribute
POINTER_VOID = auto()
PTR
class-attribute
instance-attribute
PTR = auto()
PTR_OR_ARRAY
class-attribute
instance-attribute
PTR_OR_ARRAY = auto()
PURGING_CALLING_CONVENTION
class-attribute
instance-attribute
PURGING_CALLING_CONVENTION = auto()
SCALAR
class-attribute
instance-attribute
SCALAR = auto()
SHIFTED_PTR
class-attribute
instance-attribute
SHIFTED_PTR = auto()
STRUCT
class-attribute
instance-attribute
STRUCT = auto()
SUE
class-attribute
instance-attribute
SUE = auto()
TBYTE
class-attribute
instance-attribute
TBYTE = auto()
UCHAR
class-attribute
instance-attribute
UCHAR = auto()
UDT
class-attribute
instance-attribute
UDT = auto()
UINT
class-attribute
instance-attribute
UINT = auto()
UINT128
class-attribute
instance-attribute
UINT128 = auto()
UINT16
class-attribute
instance-attribute
UINT16 = auto()
UINT32
class-attribute
instance-attribute
UINT32 = auto()
UINT64
class-attribute
instance-attribute
UINT64 = auto()
UNION
class-attribute
instance-attribute
UNION = auto()
UNKNOWN
class-attribute
instance-attribute
UNKNOWN = auto()
USER_CALLING_CONVENTION
class-attribute
instance-attribute
USER_CALLING_CONVENTION = auto()
VARARG_CALLING_CONVENTION
class-attribute
instance-attribute
VARARG_CALLING_CONVENTION = auto()
VARIABLE_STRUCT
class-attribute
instance-attribute
VARIABLE_STRUCT = auto()
VARIABLE_STRUCT_MEMBER
class-attribute
instance-attribute
VARIABLE_STRUCT_MEMBER = auto()
VOID
class-attribute
instance-attribute
VOID = auto()
VOLATILE
class-attribute
instance-attribute
VOLATILE = auto()
WELL_DEFINED
class-attribute
instance-attribute
WELL_DEFINED = auto()
TypeDetails
TypeDetails()
Comprehensive type information with category-specific attributes
Methods:
-
from_tinfo_t–Extract all type attributes and details.
Attributes:
-
array(Optional[ArrayDetails]) –Get the array type details, if any.
-
attributes(TypeAttr) –Get the general type attributes.
-
bitfield(Optional[BitfieldDetails]) –Get the bitfield type details, if any.
-
enum(Optional[EnumDetails]) –Get the enum type details, if any.
-
func(Optional[FuncDetails]) –Get the function type details, if any.
-
name(str) –Get the name of the type.
-
ptr(Optional[PtrDetails]) –Get the pointer type details, if any.
-
size(int) –Get the size of the type.
-
udt(Optional[UdtDetails]) –Get the user-defined type details, if any.
name
property
name: str
Get the name of the type.
size
property
size: int
Get the size of the type.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> TypeDetails
Extract all type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: Type details object filled with extracted information.
TypeDetailsVisitor
TypeDetailsVisitor(db: Database)
Bases: tinfo_visitor_t
Visitor class for types. Used to recursively traverse types and gather the type members details. Instances of this class can be passed to the traverse() method to initiate the traversal.
Methods:
Attributes:
-
db– -
output(list[TypeDetails]) –
db
instance-attribute
db = db
visit_type
visit_type(
out: type_mods_t, tif: tinfo_t, name: str, comment: str
) -> int
TypeFormattingFlags
Bases: IntFlag
Type formatting flags used to control type parsing, formatting and printing
Attributes:
-
HTI_DCL–Don't complain about redeclarations
-
HTI_EXT–Debug: print external representation of types
-
HTI_FIL–"Input" is file name, otherwise "input" contains a C declaration
-
HTI_HIGH–Assume high level prototypes (with hidden args, etc)
-
HTI_INT–Debug: print internal representation of types
-
HTI_LEX–Debug: print tokens
-
HTI_LOWER–Lower the function prototypes
-
HTI_MAC–Define macros from the base tils
-
HTI_NDC–Don't decorate names
-
HTI_NER–Ignore all errors but display them
-
HTI_NOBASE–Do not inspect base tils
-
HTI_NWR–No warning messages
-
HTI_PAK–Explicit structure pack value (#pragma pack)
-
HTI_PAK1–pragma pack(1)
-
HTI_PAK16–pragma pack(16)
-
HTI_PAK2–pragma pack(2)
-
HTI_PAK4–pragma pack(4)
-
HTI_PAK8–pragma pack(8)
-
HTI_PAKDEF–Default pack value
-
HTI_PAK_SHIFT–Shift for HTI_PAK. This field should be used if you want to remember
-
HTI_RAWARGS–Leave argument names unchanged (do not remove underscores)
-
HTI_RELAXED–Accept references to unknown namespaces
-
HTI_SEMICOLON–Do not complain if the terminating semicolon is absent
-
HTI_TST–Test mode: discard the result
-
HTI_UNP–Debug: check the result by unpacking it
HTI_DCL
class-attribute
instance-attribute
HTI_DCL = HTI_DCL
Don't complain about redeclarations
HTI_EXT
class-attribute
instance-attribute
HTI_EXT = HTI_EXT
Debug: print external representation of types
HTI_FIL
class-attribute
instance-attribute
HTI_FIL = HTI_FIL
"Input" is file name, otherwise "input" contains a C declaration
HTI_HIGH
class-attribute
instance-attribute
HTI_HIGH = HTI_HIGH
Assume high level prototypes (with hidden args, etc)
HTI_INT
class-attribute
instance-attribute
HTI_INT = HTI_INT
Debug: print internal representation of types
HTI_LEX
class-attribute
instance-attribute
HTI_LEX = HTI_LEX
Debug: print tokens
HTI_LOWER
class-attribute
instance-attribute
HTI_LOWER = HTI_LOWER
Lower the function prototypes
HTI_MAC
class-attribute
instance-attribute
HTI_MAC = HTI_MAC
Define macros from the base tils
HTI_NDC
class-attribute
instance-attribute
HTI_NDC = HTI_NDC
Don't decorate names
HTI_NER
class-attribute
instance-attribute
HTI_NER = HTI_NER
Ignore all errors but display them
HTI_NOBASE
class-attribute
instance-attribute
HTI_NOBASE = HTI_NOBASE
Do not inspect base tils
HTI_NWR
class-attribute
instance-attribute
HTI_NWR = HTI_NWR
No warning messages
HTI_PAK
class-attribute
instance-attribute
HTI_PAK = HTI_PAK
Explicit structure pack value (#pragma pack)
HTI_PAK1
class-attribute
instance-attribute
HTI_PAK1 = HTI_PAK1
pragma pack(1)
HTI_PAK16
class-attribute
instance-attribute
HTI_PAK16 = HTI_PAK16
pragma pack(16)
HTI_PAK2
class-attribute
instance-attribute
HTI_PAK2 = HTI_PAK2
pragma pack(2)
HTI_PAK4
class-attribute
instance-attribute
HTI_PAK4 = HTI_PAK4
pragma pack(4)
HTI_PAK8
class-attribute
instance-attribute
HTI_PAK8 = HTI_PAK8
pragma pack(8)
HTI_PAKDEF
class-attribute
instance-attribute
HTI_PAKDEF = HTI_PAKDEF
Default pack value
HTI_PAK_SHIFT
class-attribute
instance-attribute
HTI_PAK_SHIFT = HTI_PAK_SHIFT
Shift for HTI_PAK. This field should be used if you want to remember an explicit pack value for each structure/union type. See HTI_PAK... definitions
HTI_RAWARGS
class-attribute
instance-attribute
HTI_RAWARGS = HTI_RAWARGS
Leave argument names unchanged (do not remove underscores)
HTI_RELAXED
class-attribute
instance-attribute
HTI_RELAXED = HTI_RELAXED
Accept references to unknown namespaces
HTI_SEMICOLON
class-attribute
instance-attribute
HTI_SEMICOLON = HTI_SEMICOLON
Do not complain if the terminating semicolon is absent
HTI_TST
class-attribute
instance-attribute
HTI_TST = HTI_TST
Test mode: discard the result
HTI_UNP
class-attribute
instance-attribute
HTI_UNP = HTI_UNP
Debug: check the result by unpacking it
TypeKind
TypeManipulationFlags
Bases: IntFlag
Flags to be used
Attributes:
-
NTF_64BIT–value is 64bit
-
NTF_CHKSYNC–check that synchronization to IDB passed OK (set_numbered_type, set_named_type)
-
NTF_COPY–save a new type definition, not a typeref
-
NTF_FIXNAME–force-validate the name of the type when setting (set_named_type, set_numbered_type only)
-
NTF_IDBENC–the name is given in the IDB encoding;
-
NTF_NOBASE–don't inspect base tils (for get_named_type)
-
NTF_NOCUR–don't inspect current til file (for get_named_type)
-
NTF_NO_NAMECHK–do not validate type name (set_numbered_type, set_named_type)
-
NTF_REPLACE–replace original type (for set_named_type)
-
NTF_SYMM–symbol, name is mangled ('_func'); only one of NTF_TYPE and NTF_SYMU, NTF_SYMM can be used
-
NTF_SYMU–symbol, name is unmangled ('func')
-
NTF_TYPE–type name
-
NTF_UMANGLED–name is unmangled (don't use this flag)
NTF_64BIT
class-attribute
instance-attribute
NTF_64BIT = NTF_64BIT
value is 64bit
NTF_CHKSYNC
class-attribute
instance-attribute
NTF_CHKSYNC = NTF_CHKSYNC
check that synchronization to IDB passed OK (set_numbered_type, set_named_type)
NTF_COPY
class-attribute
instance-attribute
NTF_COPY = NTF_COPY
save a new type definition, not a typeref (tinfo_t::set_numbered_type, tinfo_t::set_named_type)
NTF_FIXNAME
class-attribute
instance-attribute
NTF_FIXNAME = NTF_FIXNAME
force-validate the name of the type when setting (set_named_type, set_numbered_type only)
NTF_IDBENC
class-attribute
instance-attribute
NTF_IDBENC = NTF_IDBENC
the name is given in the IDB encoding; non-ASCII bytes will be decoded accordingly (set_named_type, set_numbered_type only)
NTF_NOBASE
class-attribute
instance-attribute
NTF_NOBASE = NTF_NOBASE
don't inspect base tils (for get_named_type)
NTF_NOCUR
class-attribute
instance-attribute
NTF_NOCUR = NTF_NOCUR
don't inspect current til file (for get_named_type)
NTF_NO_NAMECHK
class-attribute
instance-attribute
NTF_NO_NAMECHK = NTF_NO_NAMECHK
do not validate type name (set_numbered_type, set_named_type)
NTF_REPLACE
class-attribute
instance-attribute
NTF_REPLACE = NTF_REPLACE
replace original type (for set_named_type)
NTF_SYMM
class-attribute
instance-attribute
NTF_SYMM = NTF_SYMM
symbol, name is mangled ('_func'); only one of NTF_TYPE and NTF_SYMU, NTF_SYMM can be used
NTF_SYMU
class-attribute
instance-attribute
NTF_SYMU = NTF_SYMU
symbol, name is unmangled ('func')
NTF_TYPE
class-attribute
instance-attribute
NTF_TYPE = NTF_TYPE
type name
NTF_UMANGLED
class-attribute
instance-attribute
NTF_UMANGLED = NTF_UMANGLED
name is unmangled (don't use this flag)
TypeMemberLookupMode
Bases: Enum
Mode for member lookup operations.
Attributes:
-
INDEX–Look up member by index (for enum, func args)
-
NAME–Look up member by name
-
OFFSET–Look up member by offset (for UDT)
-
VALUE–Look up member by value (for enum)
INDEX
class-attribute
instance-attribute
INDEX = 'index'
Look up member by index (for enum, func args)
NAME
class-attribute
instance-attribute
NAME = 'name'
Look up member by name
OFFSET
class-attribute
instance-attribute
OFFSET = 'offset'
Look up member by offset (for UDT)
VALUE
class-attribute
instance-attribute
VALUE = 'value'
Look up member by value (for enum)
Types
Types(database: Database)
Bases: DatabaseEntity
Provides access to type information and manipulation in the IDA database.
Can be used to iterate over all types in the opened database.
Args: database: Reference to the active IDA database.
Methods:
-
apply_at–Applies a named type to the given address.
-
copy_type–Copies a type and all dependent types from one library to another.
-
create_array–Create an array type.
-
create_enum–Create an enum builder.
-
create_float–Create a floating-point type.
-
create_func_type–Create a function type builder.
-
create_library–Initializes a new type library.
-
create_pointer–Create a pointer type.
-
create_primitive–Create a primitive integer type.
-
create_struct–Create a struct builder.
-
create_union–Create a union builder.
-
create_void–Create a void type.
-
export_to_library–Export all types from local library to external library.
-
export_type–Exports a type and all dependent types from the local (database) library
-
get_all–Retrieves an iterator over all types in the specified type library.
-
get_array_element_type–Get the element type of an array type.
-
get_array_length–Get the number of elements in an array type.
-
get_at–Retrieves the type information of the item at the given address.
-
get_by_name–Retrieve a type information object by name.
-
get_comment–Get comment for type.
-
get_details–Get type details and attributes.
-
get_enum_member_by_name–Get a specific enum member by name.
-
get_enum_member_by_value–Get a specific enum member by value.
-
get_enum_member_count–Get the number of members in an enum.
-
get_enum_members–Iterate over all members of an enum type.
-
get_func_argument_by_index–Get a specific function argument by index.
-
get_func_argument_count–Get the number of arguments in a function type.
-
get_func_arguments–Iterate over all arguments of a function type.
-
get_member–Get a type member (LLM-friendly unified interface).
-
get_members–Get all members of a type (LLM-friendly unified interface).
-
get_pointed_type–Get the type pointed to by a pointer type.
-
get_return_type–Get the return type of a function type.
-
get_udt_member_by_name–Get a specific UDT member by name.
-
get_udt_member_by_offset–Get a UDT member at the specified byte offset.
-
get_udt_member_count–Get the number of members in a UDT.
-
get_udt_members–Iterate over all members of a struct or union type.
-
import_from_library–Imports the types from an external library to the local (database) library.
-
import_type–Imports a type and all dependent types from an external (loaded) library
-
load_library–Loads a type library file in memory.
-
parse_declarations–Parse type declarations from string and store created types into a library.
-
parse_header_file–Parse type declarations from file and store created types into a library.
-
parse_one_declaration–Parse one declaration from string and create a named type.
-
save_library–Stores the type library to a file.
-
set_comment–Set comment for type.
-
traverse–Traverse the given type using the provided visitor class.
-
unload_library–Unload library (free underlying object).
Attributes:
-
database(Database) –Get the database reference, guaranteed to be non-None when called from
-
m_database–
database
property
database: Database
Get the database reference, guaranteed to be non-None when called from methods decorated with @check_db_open.
Returns: The active database instance.
Note: This property should only be used in methods decorated with @check_db_open, which ensures m_database is not None.
m_database
instance-attribute
m_database = database
apply_at
apply_at(
type: tinfo_t, ea: ea_t, flags: TypeApplyFlags = GUESSED
) -> bool
Applies a named type to the given address.
Args: ea: The effective address. type: The name of the type to apply. flags: Type apply flags.
Returns: True if the type was applied successfully, false otherwise.
Raises: InvalidEAError: If the effective address is invalid.
copy_type
copy_type(
source: til_t, destination: til_t, name: str
) -> int
Copies a type and all dependent types from one library to another.
Args: source: The source library. destination: The destination library. name: The name of the type.
Raises: RuntimeError: If the copy operation failed.
Returns: The ordinal number of the copied type.
create_array
create_array(element_type: tinfo_t, count: int) -> tinfo_t
Create an array type.
Args: element_type: Type of array elements. count: Number of elements.
Returns: The array type.
Example: >>> char_type = db.types.create_primitive(1) >>> buffer = db.types.create_array(char_type, 256)
create_enum
create_enum(name: str, base_size: int = 4) -> EnumBuilder
Create an enum builder.
Args: name: Name for the enum. base_size: Underlying integer size (1, 2, 4, or 8).
Returns: An EnumBuilder for constructing the type.
create_float
create_float(size: int = 4) -> tinfo_t
Create a floating-point type.
Args: size: 4 for float, 8 for double.
Returns: The floating-point type.
Raises: InvalidParameterError: If size is not 4 or 8.
create_func_type
create_func_type() -> FuncTypeBuilder
Create a function type builder.
Returns: A FuncTypeBuilder for constructing the type.
create_library
create_library(file: Path, description: str) -> til_t
Initializes a new type library.
Args: file: The name of the library. description: The description of the library.
Returns: An initialized library.
create_pointer
create_pointer(target: tinfo_t) -> tinfo_t
Create a pointer type.
Args: target: The type being pointed to.
Returns: A pointer to the target type.
Example: >>> char_type = db.types.create_primitive(1) >>> char_ptr = db.types.create_pointer(char_type)
create_primitive
create_primitive(size: int, signed: bool = True) -> tinfo_t
Create a primitive integer type.
Args: size: Size in bytes (1, 2, 4, or 8). signed: True for signed, False for unsigned.
Returns: The primitive type.
Raises: InvalidParameterError: If size is not 1, 2, 4, or 8.
Example: >>> int32 = db.types.create_primitive(4, signed=True) >>> uint8 = db.types.create_primitive(1, signed=False)
create_struct
create_struct(name: str) -> StructBuilder
Create a struct builder.
Args: name: Name for the struct.
Returns: A StructBuilder for constructing the type.
Example: >>> point = db.types.create_struct("Point") \ ... .add_member("x", db.types.create_primitive(4)) \ ... .add_member("y", db.types.create_primitive(4)) \ ... .build()
create_union
create_union(name: str) -> UnionBuilder
Create a union builder.
Args: name: Name for the union.
Returns: A UnionBuilder for constructing the type.
create_void
create_void() -> tinfo_t
Create a void type.
Returns: A void tinfo_t.
export_to_library
export_to_library(library: til_t) -> None
Export all types from local library to external library. Numbered types will be automatically enabled for the external library.
Args: library: The destination library.
export_type
export_type(destination: til_t, name: str) -> int
Exports a type and all dependent types from the local (database) library into a loaded (external) library.
Numbered types will be automatically enabled for the external library.
Args: destination: The loaded type library from where to import the type. name: The name of the type.
Raises: RuntimeError: If the export operation failed.
Returns: The ordinal number of the imported type.
get_all
Retrieves an iterator over all types in the specified type library.
Args: library: library instance to iterate over (defaults to local library). type_kind: type kind to iterate over (defaults to 'NAMED').
Returns: A types iterator.
get_array_element_type
get_array_element_type(
type_info: tinfo_t,
) -> Optional[tinfo_t]
Get the element type of an array type.
Args: type_info: An array type.
Returns: The element type, or None if not an array.
get_array_length
get_array_length(type_info: tinfo_t) -> Optional[int]
Get the number of elements in an array type.
Args: type_info: An array type.
Returns: The array length, or None if not an array.
get_at
get_at(ea: ea_t) -> Optional[tinfo_t]
Retrieves the type information of the item at the given address.
Args: ea: The effective address.
Returns: The type information object or None if it does not exist.
Raises: InvalidEAError: If the effective address is invalid.
get_by_name
get_by_name(
name: str, library: til_t = None
) -> Optional[tinfo_t]
Retrieve a type information object by name.
Args: name: Name of the type to retrieve. library: Type library to retrieve from, defaults to local library.
Returns: The named type information object or None if not found.
get_comment
get_comment(type_info: tinfo_t) -> str
Get comment for type.
Args: type_info: The type info object to get comment from.
Returns: Comment text, or empty string if no comment exists.
get_details
get_details(type_info: tinfo_t) -> TypeDetails
Get type details and attributes.
Args: type_info: The type information object for which to gather details.
Returns: Type details object.
get_enum_member_by_name
get_enum_member_by_name(
type_info: tinfo_t, name: str
) -> Optional[EnumMemberInfo]
Get a specific enum member by name.
Args: type_info: An enum type. name: Member name to find.
Returns: EnumMemberInfo if found, None otherwise.
get_enum_member_by_value
get_enum_member_by_value(
type_info: tinfo_t, value: int
) -> Optional[EnumMemberInfo]
Get a specific enum member by value.
Args: type_info: An enum type. value: Numeric value to find.
Returns: EnumMemberInfo if found, None otherwise.
get_enum_member_count
get_enum_member_count(type_info: tinfo_t) -> int
Get the number of members in an enum.
Args: type_info: An enum type.
Returns: Member count, or 0 if not an enum.
get_enum_members
get_enum_members(
type_info: tinfo_t,
) -> Iterator[EnumMemberInfo]
Iterate over all members of an enum type.
Args: type_info: An enum type.
Returns: Iterator of EnumMemberInfo for each member. Empty iterator if type is not an enum.
Example: >>> enum_type = db.types.get_by_name("FileMode") >>> for member in db.types.get_enum_members(enum_type): ... print(f"{member.name} = {member.value}")
get_func_argument_by_index
get_func_argument_by_index(
type_info: tinfo_t, index: int
) -> Optional[FuncArgumentInfo]
Get a specific function argument by index.
Args: type_info: A function type. index: Argument index (0-based).
Returns: FuncArgumentInfo if found, None otherwise.
get_func_argument_count
get_func_argument_count(type_info: tinfo_t) -> int
Get the number of arguments in a function type.
Args: type_info: A function type.
Returns: Argument count, or 0 if not a function type.
get_func_arguments
get_func_arguments(
type_info: tinfo_t,
) -> Iterator[FuncArgumentInfo]
Iterate over all arguments of a function type.
Args: type_info: A function type.
Returns: Iterator of FuncArgumentInfo for each argument. Empty iterator if type is not a function.
Example: >>> func_type = db.types.get_at(0x401000) >>> for arg in db.types.get_func_arguments(func_type): ... print(f"Arg {arg.index}: {arg.name}")
get_member
get_member(
type_info: tinfo_t,
key: Union[str, int],
by: Union[TypeMemberLookupMode, str] = NAME,
) -> Optional[
Union[UdtMemberInfo, EnumMemberInfo, FuncArgumentInfo]
]
Get a type member (LLM-friendly unified interface).
Works for struct/union members, enum members, and function arguments.
Args: type_info: The type to inspect. key: Lookup key (name, offset, index, or value depending on 'by'). by: Lookup mode: - "name": Look up by member/argument name - "offset": Look up by byte offset (UDT only) - "index": Look up by index (enum, func args) - "value": Look up by enum value (enum only)
Returns: The member info if found, None otherwise.
Example: >>> # Get struct member by name >>> member = db.types.get_member(struct_type, "x", by="name") >>> # Get struct member by offset >>> member = db.types.get_member(struct_type, 4, by="offset") >>> # Get function argument by index >>> arg = db.types.get_member(func_type, 0, by="index")
get_members
get_members(
type_info: tinfo_t,
) -> Iterator[
Union[UdtMemberInfo, EnumMemberInfo, FuncArgumentInfo]
]
Get all members of a type (LLM-friendly unified interface).
Works for struct/union types, enum types, and function types.
Args: type_info: The type to inspect.
Returns: Iterator of member info objects. Empty iterator if type has no members.
Example: >>> for member in db.types.get_members(struct_type): ... print(f"{member.name}")
get_pointed_type
get_pointed_type(type_info: tinfo_t) -> Optional[tinfo_t]
Get the type pointed to by a pointer type.
Args: type_info: A pointer type.
Returns: The pointed-to type, or None if not a pointer.
Example: >>> ptr_type = db.types.get_at(0x401000) # char* >>> base = db.types.get_pointed_type(ptr_type) # char
get_return_type
get_return_type(type_info: tinfo_t) -> Optional[tinfo_t]
Get the return type of a function type.
Args: type_info: A function type.
Returns: The return type, or None if not a function type.
get_udt_member_by_name
get_udt_member_by_name(
type_info: tinfo_t, name: str
) -> Optional[UdtMemberInfo]
Get a specific UDT member by name.
Args: type_info: A UDT (struct or union) type. name: Member name to find.
Returns: UdtMemberInfo if found, None otherwise.
get_udt_member_by_offset
get_udt_member_by_offset(
type_info: tinfo_t, offset: int
) -> Optional[UdtMemberInfo]
Get a UDT member at the specified byte offset.
Args: type_info: A UDT (struct or union) type. offset: Byte offset within the structure.
Returns: UdtMemberInfo if found, None otherwise.
get_udt_member_count
get_udt_member_count(type_info: tinfo_t) -> int
Get the number of members in a UDT.
Args: type_info: A UDT type.
Returns: Member count, or 0 if not a UDT.
get_udt_members
get_udt_members(
type_info: tinfo_t,
) -> Iterator[UdtMemberInfo]
Iterate over all members of a struct or union type.
Args: type_info: A UDT (struct or union) type.
Returns: Iterator of UdtMemberInfo for each member. Empty iterator if type is not a UDT.
Example: >>> struct_type = db.types.get_by_name("MyStruct") >>> for member in db.types.get_udt_members(struct_type): ... print(f"{member.name}: {member.size} bytes at offset {member.offset}")
import_from_library
import_from_library(library: til_t) -> None
Imports the types from an external library to the local (database) library.
Args: library: The library instance to import from.
Returns: The status of the add library operation.
import_type
import_type(source: til_t, name: str) -> int
Imports a type and all dependent types from an external (loaded) library into the local (database) library.
Args: source: The loaded type library from where to import the type. name: The name of the type.
Raises: RuntimeError: If the import operation failed.
Returns: The ordinal number of the imported type.
load_library
load_library(file: Path) -> til_t
Loads a type library file in memory.
Args: file: The path of the library file to load. The library name can be passed with or without extension (.til extension will be forced) and as a relative (default ida til directory will be used) or absolute path.
Returns: The loaded til_t object.
parse_declarations
parse_declarations(
library: til_t,
decl: str,
flags: TypeFormattingFlags = HTI_DCL | HTI_PAKDEF,
) -> int
Parse type declarations from string and store created types into a library.
Args: library: The type library into where the parsed types will be stored. decl: C type declarations input string. flags: Optional combination of TypeFormattingFlags.
Returns: Number of parse errors.
parse_header_file
parse_header_file(
library: til_t,
header: Path,
flags: TypeFormattingFlags = HTI_FIL | HTI_PAKDEF,
) -> int
Parse type declarations from file and store created types into a library.
Args: library: The type library into where the parsed types will be stored. header: The path to a header file. flags: Optional combination of TypeFormattingFlags.
Returns: Number of parse errors.
parse_one_declaration
parse_one_declaration(
library: til_t,
decl: str,
name: str,
flags: TypeFormattingFlags = HTI_DCL | HTI_PAKDEF,
) -> tinfo_t
Parse one declaration from string and create a named type.
Args: library: The type library used for parsing context. decl: C type declaration string to parse. name: The name to assign to the parsed type. flags: Optional combination of TypeFormattingFlags for parsing behavior.
Returns: The tinfo_t instance on success.
Raises: InvalidParameterError: If name/decl is empty, decl cannot be parsed, or name cannot be used to save the declaration.
save_library
save_library(library: til_t, file: Path) -> bool
Stores the type library to a file. If the library contains garbage, it will be collected before storing it. Also compacts the library before saving.
Args: library: The type library instance to save to disk. file: The path to save the library to.
Returns: True if the operation succeeded, False otherwise.
set_comment
set_comment(type_info: tinfo_t, comment: str) -> bool
Set comment for type. This function works only for non-trivial types
Args: type_info: The type info object to set comment for. comment: Comment text to set.
Returns: True if successful, False otherwise.
traverse
traverse(
type_info: tinfo_t, visitor: tinfo_visitor_t
) -> None
Traverse the given type using the provided visitor class.
Args: type_info: The type information object to visit. visitor: A type visitor subclassed object.
Returns: True if traversal was successful, False otherwise.
unload_library
unload_library(library: til_t) -> None
Unload library (free underlying object).
Args: library: The library instance to unload.
UdtAttr
Bases: Flag
User Defined Type flags
Attributes:
CPP_OBJ
class-attribute
instance-attribute
CPP_OBJ = auto()
FIXED
class-attribute
instance-attribute
FIXED = auto()
MS_STRUCT
class-attribute
instance-attribute
MS_STRUCT = auto()
TUPLE
class-attribute
instance-attribute
TUPLE = auto()
UNALIGNED
class-attribute
instance-attribute
UNALIGNED = auto()
UNION
class-attribute
instance-attribute
UNION = auto()
VFTABLE
class-attribute
instance-attribute
VFTABLE = auto()
UdtDetails
UdtDetails()
User Defined Type details
Methods:
-
from_tinfo_t–Extract UDT type attributes and details.
Attributes:
-
attributes(Optional[UdtAttr]) –Get UDT attributes.
-
num_members(int) –Get number of members.
num_members
property
num_members: int
Get number of members.
from_tinfo_t
classmethod
from_tinfo_t(type_info: tinfo_t) -> Optional[UdtDetails]
Extract UDT type attributes and details.
Args: type_info: The type information objects for which to extract details.
Returns: UDT type details object filled with extracted information.
UdtMemberInfo
dataclass
UdtMemberInfo(
name: str,
type: tinfo_t,
offset: int,
size: int,
is_bitfield: bool,
bit_offset: Optional[int] = None,
bit_size: Optional[int] = None,
)
Details about a struct/union member.
Attributes:
-
bit_offset(Optional[int]) –Bit offset within the byte (for bitfields only).
-
bit_size(Optional[int]) –Bit size (for bitfields only).
-
is_bitfield(bool) –True if this is a bitfield member.
-
name(str) –Member name.
-
offset(int) –Byte offset within the structure.
-
size(int) –Size in bytes.
-
type(tinfo_t) –Member type information.
bit_offset
class-attribute
instance-attribute
bit_offset: Optional[int] = None
Bit offset within the byte (for bitfields only).
bit_size
class-attribute
instance-attribute
bit_size: Optional[int] = None
Bit size (for bitfields only).
is_bitfield
instance-attribute
is_bitfield: bool
True if this is a bitfield member.
name
instance-attribute
name: str
Member name.
offset
instance-attribute
offset: int
Byte offset within the structure.
size
instance-attribute
size: int
Size in bytes.
type
instance-attribute
type: tinfo_t
Member type information.
UnionBuilder
UnionBuilder(name: str)
Builder for creating union types.
Example: >>> builder = db.types.create_union("MyUnion") >>> builder.add_member("as_int", db.types.create_primitive(4)) >>> builder.add_member("as_float", db.types.create_primitive(4)) >>> my_union = builder.build()
Initialize a union builder.
Args: name: Name for the union type.
Methods:
-
add_member–Add a member to the union.
-
build–Build and return the union type.
-
build_and_save–Build the union and save it to a type library.
add_member
add_member(
name: str, member_type: tinfo_t
) -> 'UnionBuilder'
Add a member to the union.
Args: name: Member name. member_type: Member type.
Returns: Self for method chaining.
build
build() -> tinfo_t
Build and return the union type.
Returns: The constructed tinfo_t.
Raises: RuntimeError: If union creation fails.
build_and_save
build_and_save(library: Optional[til_t] = None) -> tinfo_t
Build the union and save it to a type library.
Args: library: Target library (local library if None).
Returns: The constructed and saved tinfo_t.